View Full Version : CSS: first-of-type....but not.

12-30-2007, 11:23 PM
solved :)

12-30-2007, 11:45 PM
solved :)

this don't help anybody who try to find a solution to the same problem.

best regards

12-30-2007, 11:54 PM
i wanted to find a way to remove the top margin from the first child and the bottom margin from the last child, but only if they were <p> elements.

i realized that :first-child and :last-child already do type checks alongside the pseudo check:

div.dlg_contents > p:first-child {margin-top: 0;}
div.dlg_contents > p:last-child {margin-bottom: 0;}

12-31-2007, 01:35 AM
i realized that :first-child and :last-child already do type checks alongside the pseudo check

Not in all browsers, though, and if at all then buggy in some.

12-31-2007, 03:16 AM
This is for an internal webapp where i have control over the browser choice of the enduser.

IE ruins "public domain" web development for me. ie7 does a lot to make it better, and i have high hopes for php support in Expression Web Designer 2.0, i think it does a great job with usability, and its rendering engine is the best i've seen yet.

that aside, i only code internal webapps these days, for web standards - not hacks and workarounds, and test with standards compliant browsers. (Firefox 3b3 and Opera 9.50b1) I have no intention of going into public web development until the now-Acid2-complaint IE8 has been fully adopted by all IE users, which will probably be another 10 years. I demand 95&#37; implementation uniformity in Javascript/AJAX, CSS/XHTML, DOM. My time is better utilized NOT maintaining 2 codebases - something that Microsoft has made a necessity until recently, when alternatives have been freely and readily available.