> Is there any need for the child > selector?
Well, the problem I have is the following: in my html I have 3 <h2>
tags with one or more paragraphs between them, for example:
<div id="main-body">
<!-- start section 1 -->
<h2>heading 1</h2>
<p>paragraph 1</p>
<p>paragraph 2</p>
<!-- end section 1 -->
<!-- start section 2 -->
<h2>heading 2</h2>
<p>paragraph 1</p>
<p>paragraph 2</p>
<p>paragraph 3</p>
<!-- end section 2 -->
<!-- start section 3 -->
<h2>heading 3</h2>
<p>paragraph 1</p>
<!-- end section 3 -->
</div>
I want a seperator line above each <h2> header, except for the first
one. This line then visually separates my sections (you can take a
look at my current homepage
http://www.veerle-en-koen.be/ which is not
implemented like described above, but has the seperator lines, just to
get an idea of what I mean). I would like to do this seperator in css
(a line image which is in the background and aligned to the top)
because this is pure layout and has nothing to do with the html. This
enables me to later on change the layout of my page and for example
not to have line in between my sections any more and this without
changing a thing to my html.
But if IE6 doesn't support the first-child pseudo class, then the only
possibility left is to define a different css class for the first <h2>
and for the rest of them. But this is not really the propper way to do
this, I think. This is a common problem though: often you want to do
something else with the first element then with the following ones,
which is exactly why the W3C people came up with first-child selector.
Setting font sizes in pixels is a bad idea as it makes it difficult
for IE users to resize the text.
Interesting opinion... What I'm trying to accomplish is to create a
page that looks exactly the same in any browser (that supports CSS2
anyway). If I do not specify the size of my <h2> text, I'm dependent
on what size the browser uses for its <h2> and my page wont look the
same any more in all browsers...