Reputation: 2661
What I want to do is to apply a specific title to any element with a specific class.
HTML
<span class="br">BR</span>
<span class="dvd">DVD</span>
<span class="br">BR</span>
<span class="br">BR</span>
<span class="sc">Sc</span>
CSS
span{
width: auto;
height: auto;
padding: 5px;
color: white;
}
.br{
background: blue;
}
.dvd{
background: green;
}
.sc{
background: black;
}
How can I set a title to any element with the class "br"? Is it better to do it with jQuery?
Upvotes: 0
Views: 3937
Reputation: 3774
Do it with jquery. CSS is a presentation language. It isn't designed to add content, aside from :before
and :after
Jquery:
$('.br').attr('title','yourtitle');
Upvotes: 5