Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

CSS last-child on HTML5 article

CSS last-child on HTML5 article


In my blog, I have a series of HTML5 articles like so:


Lorem ipsum dolor sit amet, Consectetur Adipiscing Elit. Ut laoreet, ligula in commodo vestibulum, erat purus consectetur ipsum, ac sodales quam risus id nibh. Suspendisse iaculis egestas nisi et pharetra. Proin gravida, eros et aliquam tempus, massa diam feugiat urna, vestibulum suscipit purus diam vitae turpis. Cras congue aliquet sollicitudin. Fusce sit amet dui odio. In vitae dictum ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Read More
....this article repeats 7 times

I want to use css selector, last-child to select the last article and remove the bottom border. Normally I would use{margin-bottom:0; padding:0; border-bottom:0} but for some reason this isnt selecting the last article. Any idea what I am doing wrong? It works great if I was to use an unordered list, but not so much with articles.

Problem courtesy of: JCHASE11


I think this is just personal preference, but try defining your parent within the selector:



Also, instead of:

I think using a Section tag may be more semantic.

Solution courtesy of: Shawn Wernig


View additional discussion.

This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

CSS last-child on HTML5 article


Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription