Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS How to target first instance on a page. Reply To: How to target first instance on a page.

#237896
Paulie_D
Member

I’m trying to target the first H1 on a page and make it all caps.

There is no CSS selector to do this as first/nth is based on the parent.

You need JS/JQ.

$( "h1" ).first().css( "text-transform", "uppercase" );

http://codepen.io/Paulie-D/pen/KVbwKQ