I have two paragraphs wrapped in a div. I want to make the first paragraphs text a little larger but using the :first-child does not work the way I am calling it. Cant see what is wrong.
<div id="main-content">
<h2 class="title">
About Us
</h2>
<p>Formerly Days Hotel Waterford, Treacys Hotel Spa & Leisure Centre is situated in the heart of Waterford City in Ireland's Sunny South-East, and is proud to be one of the finest hotels in Waterford. The hotel is the perfect choice for your business, leisure and family breaks. Guests can dine in Croker's Restaurant, enjoy a drink with friends in Timbertoes bar, relax in the swimming pool or Jacuzzi at Spirit Leisure Centre or be pampered at Spirit Beauty Spa.
</p>
<p>
The hotel is ideally located on the Quays in Waterford and is just a five minute walk from both the bus and train stations, and only 10km from Waterford Airport. Treacys hotel is one of the finest hotels in Waterford city centre and is a popular location for visitors who love shopping, golf, surfing, or choose from our selection of great value packages, including pampering spa breaks and activity breaks.
</p>
</div><!-- inner content End -->
CSS:
#main-content p:first-child {
font-size:16px;
}
The first child of
#main-contentis not ap, it’s anh2.If you want to apply the rule to the first
p, use CSS3:first-of-type:Or
h2:first-childwith a sibling selector, which plays more nicely with IE: