If I have clear:both;
in the #message
declaration then padding-top:30px;
in the
#message p
declaration will be correct but if I remove the clear:both
in the
#message
declaration then padding-top:30px;
doesn't take effect.
So why do I need clear:both
in the #message
declaration for being able to use
padding-top
in the #message p
declaration.
CSS
body {
margin: 5px;
padding: 0;
font-family: Arial, sans-serif;
font-size: small;
text-align: center;
width: 768px;
}
#register {
float: left;
width: 100%;
margin: 0;
padding: 0;
list-style: none;
color: #690;
background: #BDDB62;
}
#register a {
text-decoration: none;
color: #360;
}
#reg {
float: left;
margin: 0;
padding: 8px 14px;
}
#find {
float: right;
margin: 0;
padding: 8px 14px;
}
#message {
clear: both;
font-weight: bold;
font-size: 110%;
color: #fff;
text-align: center;
background: #92B91C;
}
#message p {
margin: 0;
padding-top: 30px;
}
#message strong { text-transform: uppercase }
#message a {
margin: 0 0 0 6px;
padding: 2px 15px;
text-decoration: none;
font-weight: normal;
color: #fff;
}
HTML
<ul id="register">
<li id="reg">Not registered? <a href="#">Register</a> now!</li>
<li id="find"><a href="#">Find a store</a></li>
</ul>
<div id="message">
<p>
<strong>Special this week:</strong> $2 shipping on all orders!
<a href="#">LEARN MORE</a>
</p>
</div>