[html5] last-child

Simon Pieters simonp at opera.com
Thu Nov 3 01:47:21 PDT 2011


On Thu, 03 Nov 2011 03:15:59 +0100, Kenneth W Foy, Jr  
<kete at ninthfloor.org> wrote:

> On Wed, 2 Nov 2011 23:13:51 -0200, Maujor (via-gmail) wrote:
>> Yes it works!
>> Have a look at: http://jsbin.com/ulotuf/edit#html
>
> Thanks, I figured out why mine wasn’t working: I had a different
> kind of tag after the last paragraph tag, so the last paragraph
> tag wasn’t the last child of the article parent. I reproduced it
> on your jsbin with a div child after the last paragraph child. So
> I just took out the pseudo class and got the result I wanted
> without losing the top margins between the paragraphs.
>
> last-child is “the last child of some other element”, not the
> last instance of a particular tag before one or more other types
> of children. http://www.w3.org/TR/selectors/#last-child-pseudo

:last-of-type maybe does what you want.

-- 
Simon Pieters
Opera Software



More information about the Help mailing list