johnmerlino
05-26-2010, 05:58 PM
I think I'm seeing strange behavior here that is inconsistent with my understanding of floats and margins. 1) I have two ul elements floating and a div sits under them without any clear: both property - that is, I don't have a clear:both property specified. That's strange because it's supposed to be ignoring the floats but it doesn't and sits under the floats (which is what I want but usually it requires clear: both). 2) The two ul elements have no bottom margin and so I try to assign the div below them a top margin yet it won't move at all until I assign it a huge top margin of 5em. This is odd behavior because there should be no margins competing here since the ul elements don't have any. 10px top margin should be able to work for the div but it doesn't. Here's what I have:
<style>
#contactUs {
width: 500px;
margin: 0 auto;
overflow: auto;
font: normal normal normal 1em/1.2 Arial, Verdana, sans-serif;
}
#contactUs h1 {
text-align: center;
color: #939598;
font-weight: bold;
}
#contactUs ul {
margin: 0;
padding: 0;
list-style-type: none;
line-height: 1.5em;
font: normal normal normal 1em/1.5 Arial, Verdana, sans-serif;
}
ul#contactFort {
float: left;
width: 260px;
margin: 5px 0 0 5px;
}
ul#contactPrin {
float: right;
width: 230;
margin: 5px 0 0 5px;
}
#mailTo {
text-align: center;
margin-top: 1em;
}
#contactUs a {
text-decoration: none;
color: green;
}
</style>
<div id="contactUs">
<h1>Contact Us</h1>
<ul id="contactFort">
<li>200 Wells Drive</li>
<li>Yellow Springs, OH</li>
<li>800-000-0000</li>
</ul>
<ul id="contactPrin">
<li>100 Main St.</li>
<li>Printown, OH</li>
<li>800-000-0000</li>
</ul>
<div id="mailTo"><a href="mailto:info@us.com">info@us.com</a></div>
</div>
Thanks for any insight.
<style>
#contactUs {
width: 500px;
margin: 0 auto;
overflow: auto;
font: normal normal normal 1em/1.2 Arial, Verdana, sans-serif;
}
#contactUs h1 {
text-align: center;
color: #939598;
font-weight: bold;
}
#contactUs ul {
margin: 0;
padding: 0;
list-style-type: none;
line-height: 1.5em;
font: normal normal normal 1em/1.5 Arial, Verdana, sans-serif;
}
ul#contactFort {
float: left;
width: 260px;
margin: 5px 0 0 5px;
}
ul#contactPrin {
float: right;
width: 230;
margin: 5px 0 0 5px;
}
#mailTo {
text-align: center;
margin-top: 1em;
}
#contactUs a {
text-decoration: none;
color: green;
}
</style>
<div id="contactUs">
<h1>Contact Us</h1>
<ul id="contactFort">
<li>200 Wells Drive</li>
<li>Yellow Springs, OH</li>
<li>800-000-0000</li>
</ul>
<ul id="contactPrin">
<li>100 Main St.</li>
<li>Printown, OH</li>
<li>800-000-0000</li>
</ul>
<div id="mailTo"><a href="mailto:info@us.com">info@us.com</a></div>
</div>
Thanks for any insight.