Ben Paton Ben Paton - 8 months ago 35
CSS Question

style 2nd element on the page with same class

Hello is there a way with css to style the 2nd element on page with the same class slightly differently to the first.

For example I have two ul's on a page with a class of topbardropdownmenu. I want to give the 2nd ul a differen't background to the first. Is there a way to do this with out altering the html?


What holds the <ul> elements? I'll assume a <div id = "lists">

/* First element */
div > ul.topbardropdownmenu:first-child{


/* Rest of the elements */
div > ul.topbardropdownmenu{



div > ul.topbardropdownmenu:not(:first-child)