Im trying to get my head about how to format the css to achieve the desired effect.
I have a section with news, and i want the first instance to be say 200px high, and all the rest 100px for example.
I've tried a handful of variations on where to place the :first-of-type, and its never right.
So i'd assumed i wanted to write something like:
PHP Code:
<style type="text/css">
.f605 { width:603px; }
.c605 { width:585px; }
#webnews .c605.rounded:first-of-type { background-color: yellow; }
#webnews .c605.rounded { background-color: green; }
</style>
<div id="webnews" class="f605">
<div class="c605 notrounded">Website News</div>
<div class="c605 rounded">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vel justo sed ligula vulputate adipiscing.</p>
</div>
<div class="c605 rounded">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vel justo sed ligula vulputate adipiscing.</p>
</div>
<div class="c605 rounded">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vel justo sed ligula vulputate adipiscing.</p>
</div>
</div>
What i dont understand is why the row
<div class="c605 notrounded">Website News</div> breaks the code. If i change that from 'notrounded' to 'rounded' or nothing, then suddenly i get 1 yellow box and the rest green, which is what i'd expect.
Why isnt it only acting on the first instance of a match, and painting that yellow, rather than seemingly seeing 1 similar instance, deciding its wrong, and then refusing to act on the first match.
It doesnt paint it green or yellow, nor would i expect it to, because it doesnt match, so why is it clashing with it and stopping any instance from being yellow?
the c605/f605 values arent important here, but they are on the proper layout i've just stripped as much away to try and eliminate potential issues.
what is it im missing/misunderstanding?