我正在处理web ticTacToe应用程序;然而,3行左对齐。我需要中心对齐。我已经成功地将1行和2行对齐居中,但由于某种原因,CSS不适用于3行。有人能发现问题是什么吗?我如何对齐中心3行ticTacToe
body {
background-color: #999;
font-family: sans-serif, verdana;
}
.container {
margin: 0 auto;
text-align: center;
}
.row>div {
margin: 5px;
border: solid 1px black;
display: inline-block;
font-size: 35px;
width: 50px;
height: 50px;
text-align: center;
}
<div class="container">
<!-- header -->
<div class="header">
<h1>TicTacToe</h1>
<h2>You're playing against the computer!</h2>
</div>
<div class="ticTacToe">
<!-- first row (3 square) -->
<vid class="row">
<div class="square">X
</div>
<div class="square">0
</div>
<div class="square">X
</div>
</div>
<!-- second row (3 square) -->
<vid class="row">
<div class="square">X
</div>
<div class="square">0
</div>
<div class="square">X
</div>
</div>
<!-- third row (3 square) -->
<vid class="row">
<div class="square">0
</div>
<div class="square">X
</div>
<div class="square">0
</div>
</div>
</div>
</div>
可能是事实,你行不div的,但VID的。 – Vilsol
你有'vid'你的意思是'div'吗?它看起来像你正在关闭外部股利。 –
考虑使用一些改进的空白/缩进。 –