I am struggling to find the best way to center a chess game board inside a colored box on my webpage. My main objective is to have the board vertically centered on the page regardless of the monitor width. I am torn between setting a fixed pixel width for the board or using a percentage width. Initially, I thought about creating a wrapper to keep the board centered, but that approach did not yield the desired results. After doing some research on another website, I came up with this new method. What is the simplest way to achieve this?
<div class="box">
<div id="gameboard">
^The table cells are located below this section, but they are not relevant to my current question.
.box {
width: 75%;
position: relative;
margin: 0 auto;
background-color: #3F3F3F;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-border-radius: 5px;
}
#gameboard {
width: 562px;
text-align: center;
cursor: pointer;
padding-top: 25px;
padding-bottom: 25px;
margin: 0 auto;
}
I apologize if my code appears messy, and any assistance provided would be greatly appreciated!