Why is this not working? http://jsfiddle.net/84C5W/1/
<style> p{ display : none; } p.visible:last-of-type { display : block; }โ </style> <div> <p class="visible">This should be hidden</p> <p class="visible">This should be displayed</p> <p class="">This should be hidden</p> </div>
In fact, none of my <p> are visible. If I remove the link to ".visible" in the stylesheet, this will show the last <p> in the div, but that is not what I want.
Of course, I could always keep one โvisibleโ always, but this is for the opening.js presentation, and I have no control over javascript. Only a stylesheet ...
Edit : Ok, so obvious. Class: last-of-type does not work. According to @Justus Romijn, the last-of-type class pseudo-class was intended only for selecting elements (which, in my opinion, is extremely limiting, and puts this particular pseudo-class in a more or less useless state).
In any case, I want to rephrase my question at this point: how can I select the last element inside a div with the class ".visible"? I do NOT want to use Javascript for this.
html css3
รystein Amundsen Nov 25 '12 at 19:22 2012-11-25 19:22
source share