gpt4 book ai didi

html - 如何使用 CSS 使 DIV 居中?

转载 作者:太空宇宙 更新时间:2023-11-03 19:38:36 26 4
gpt4 key购买 nike

我想知道如何使用 CSS 将 div 居中。我用谷歌搜索了一些东西并检查了 stackoverflow,但它与我的 CSS 代码冲突。

这是我的代码(以防万一):

body, p, span, div  {
font-family: 'Droid Sans', arial, serif;
font-size:12px;
line-height:18px;
color:#6d6d6d; }
.countdown {
padding-top:15px; width: 100%;
height: 68px;
margin:0 auto 0 auto;
bottom:0;
position:absolute;
}
.countdown .countdown_section{
background:url('images/backcountdown.png') no-repeat 1px top;
float:left;
height:100%;
width:54px;
margin:0 5px;
text-align:center;
line-height:6px;
}
.countdown .countdown_amount {
font-size:15px;
color:#ab7100;
text-shadow:0 0.8px #fedd98;
line-height:52px;
font-weight:bold;
text-align: left;
}
.countdown span {
font-size:8px;
color:#999999;
text-transform:uppercase;
line-height:26px;
}
<body>
<div class="countdown clearfix">
</div>
</body>

最佳答案

以下自动将元素水平居中:

margin: 0 auto;

关于html - 如何使用 CSS 使 DIV 居中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8609447/

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