我创建一个网站,并正尝试通过侧(水平)堆栈4 div元素侧创建水平堆叠格
http://i40.tinypic.com/28tkuq8.png
上面的图片是它是如何当前出现。
而且这是我希望它看起来:http://i44.tinypic.com/2h3v8ue.png
这是我的HTML代码我使用:
<div id="linkscontainer" align="center">
<div id="1">
<a href="link">1</a>
</div>
<div id="2">
<a href="link">2</a>
</div>
<div id="3">
<a href="link">3</a>
</div>
<div id="4">
<a href="link">4</a>
</div>
</div>
我的CSS:
#linkscontainer {
marin-left: auto;
margin-right: auto;
width: 800px;
height: 60px;
}
#1 {
background-color: #3B5998;
height: 60px;
width: 25%;
font-family: 'Nixie One', cursive;
color: #F0F0F0;
font-size: 24px;
text-align: center;
line-height: 60px;
}
#2 {
background-color: #00B5B5;
height: 60px;
width: 25%;
font-family: 'Nixie One', cursive;
color: #F0F0F0;
font-size: 24px;
text-align: center;
line-height: 60px;
}
#3 {
background-color: #F78F10;
height: 60px;
width: 25%;
font-family: 'Nixie One', cursive;
color: #F0F0F0;
font-size: 24px;
text-align: center;
line-height: 60px;
}
#4 {
background-color: #EF0E11;
height: 60px;
width: 25%;
font-family: 'Nixie One', cursive;
color: #F0F0F0;
font-size: 24px;
text-align: center;
line-height: 60px;
}
任何帮助非常感谢:)
谢谢
使用'#1,#2,#3,#4 {display:inline-block}'。 – Vucko