I have a div and some spans inside it. I have a problem that when I use absolute positioning my word-spacing
property does not work properly.
For more clearance here is the 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;
}
How can I fix that error?
Any help would be highly appreciated!
Wrap your spans in a div (or other container) and position the container like:
<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;
}