我想知道如何以divCSS 为中心.我搜索了一些东西并检查了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;
}Run Code Online (Sandbox Code Playgroud)
<body>
<div class="countdown clearfix">
</div>
</body>Run Code Online (Sandbox Code Playgroud)
以下内容自动将元素水平居中:
margin: 0 auto;
Run Code Online (Sandbox Code Playgroud)