Forum Moderators: not2easy
Here's the html code:
<h2>Announcements</h2>
<div class="headdivider"></div>
Here's the CSS code:
h2 {
font-size: 1.2em;
font-weight: bold;
margin-bottom: 0pt;
}
.headdivider {
margin-top: 0pt;
margin-bottom: 6pt;
border-bottom: #bdbabd 2px solid;
width: 540px;
}
If FloppyCopy is right, and your intent here is to provide an underline on the text that also extends beyond the text to the width specified, you don't need an extra div to do it. While text-decoration: underline will not extend beyond the text, a border-bottom on the <h2> itself will, and is more likely to display uniformly across browser (or at least will be eaasier to fix since you'd only be dealing with ONE element's default margins and padding).
cEM
As I read the specs it seems that <length>, which margins, borders and padding use, can be set with any of the following em, ex, px, in, cm, mm, pt, or pc.
I did try setting all the measurements to pixels but that had no effect on my problem.
Even though they all work, I am going to try and be more consistent in what I use for <length>.
Thanks.
can be set with any of the following em, ex, px, in, cm, mm, pt, or pc
While any of those measurement values can be used to specify lengths, that doesn't mean that they SHOULD be.
The primary difference between PT and PX (other than the fact that they provide different sizes) is this: PT is a measurement derived from print media, and is 'best' used in that medium. PX is a screen media size, based on the details of how web pages are displayed (in pixels) and is therefor considered a more 'screen appropriate' measurement.
Ultimately, it probably doesn't matter, and like Kaled, I'm no expert, but I believe the 'accepted best practice' is to reserve PT sizing for print media stylesheets and use PX (or a relative sizing unit, like EM) on screen.
cEM