gpt4 book ai didi

CSS3 : centering with CSS only

转载 作者:行者123 更新时间:2023-11-28 11:10:24 24 4
gpt4 key购买 nike

这是我的 fiddle :http://jsfiddle.net/rkfC9/

过去,当您可以简单地在 HTML 本身中编写时,它是如此容易,而使用 CSS 应该更容易,但对我来说没有任何效果。将此表中两行的内容居中的最简单方法是什么?

#table {
float:left;
}
#table td {
margin-left:auto;
margin-right:auto;
}
#brand {
width:40px;
height:40px;
background:red;
}

最佳答案

如果您将边距设置应用于内容,它将居中:

#brand {
margin-left:auto;
margin-right:auto;
width:40px;
height:40px;
background:red;
}

关于CSS3 : centering <td> with CSS only,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22023435/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com