Is a cross browser solution required? If so, I'm not sure if this can be done using CSS. However, this is easy to accomplish with jQuery:
jsFiddle: http://jsfiddle.net/SVTxD/
$(document).ready(function(){ $('div.myDiv').each(function(){ console.log($(this).children().length); if ($(this).children('p').length > 1){ $(this).children('p').first().hide(); } }); });
Alternatively (thanks to BoltClock):
$(document).ready(function(){ $('div.myDiv p:first-child:nth-last-child(2)').hide(); });
If jQuery is not a parameter (or it does not need to work in older browsers), then the correct answer is Josh C.
EDIT: Alternatively, the AddB @BoltClock clause is included.
source share