Skip to content

CSS Style element by its Title

Today I saw something new for me:

a[title=”Home”] {
font-style:italic;
}

And it’s applied to an element which has the title Home in my case it was:
<a title=”Home” href=”#”>Something</a>

So there is a way to style elements by their title, no need to add a class or id in such case.
I tested on most browsers and it works exceps of IE6, but who cares of this old browser.

Published inCoding