Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使文本居中位于单元格的中间:
table_img
一个单元格的html:
<td> <label for="mcoin"><img src="relics/19.png">Molten Coin</label> <input type="checkbox" id="check" onClick="MC()" name="mcoin"> </td>
当我使用 p 标签时,它会使单元格变宽并且不以 img 为中心。
你需要使用vertical-align: middle,你很高兴
vertical-align: middle
演示
CSS
td img { vertical-align: middle; }