react-chess / chessground

Chessground React Wrapper
https://www.npmjs.com/package/@react-chess/chessground
GNU General Public License v3.0
29 stars 5 forks source link

Chessboard doesn't seem to be affected by styling. #9

Closed d-luca727 closed 2 years ago

d-luca727 commented 2 years ago

I have this code:

                  <div className="board">
                    <Chessground
                      width={boardWidth}
                      height={boardWidth}
                      config={config}
                    />
                  </div>

.board {
  margin: 0 auto;
  text-align: center;
  position: relative;
}

(e.g. https://imgur.com/qfqmrvp) Chessground doesn't change according to my css, how do I fix? I've built a lot of chess projects just to play around with this wrapper and this is the only thing I can't figure out.

H-Richard commented 2 years ago
<div className="container"> 
  <div className="board">
    <Chessground
       config={config} 
       contained />
  </div>
</div>

I recommend something like this instead, the board class needs to have width and height property set, and you can style it however you like after

d-luca727 commented 2 years ago

It worked like a charm, thanks for helping out!