我有一个div和一些span在里面。我有一个问题,当我使用绝对定位我的word-spacing
属性不能正常工作。
关于更多的清除,这里是jsFiddle。
HTML:<section id="header">
<span>HOME</span>
<span class="no-spacing">ABOUT US</span>
<span>PORTFOLIO</span>
<span class="no-spacing">CONTACT US</span>
</section>
CSS: html, body{
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
#header {
width: 100%;
height: 30%;
background-image: url(http://www.7daysinhavana.com/wordpress/wp-content/themes/7days/images/commun/back_header_global.jpg);
font-family: 'GarageGothicBlackRegular';
word-spacing: 20px;
font-size: 25px;
text-align: center;
position: relative;
}
#header span {
position: absolute;
bottom: 0px;
}
.no-spacing {
word-spacing: 0px;
}
我如何修复这个错误?
任何帮助将非常感激!
在div(或其他容器)中换行,并将容器定位为:
<section id="header">
<div>
<span>HOME</span>
<span class="no-spacing">ABOUT US</span>
<span>PORTFOLIO</span>
<span class="no-spacing">CONTACT US</span>
</div>
</section>
CSS #header div {
position: absolute;
width:100%;
bottom: 0px;
}
<<p> jsFiddle例子/strong>