Firdavs Kurbonov
Firdavs Kurbonov

Reputation: 1252

How to change font-size of a tag using inline css?

Can't change font-size of a tag for given below code

<td valign="top" width="620"><strong><a href="images/pub/pub1.pdf" target="_self">Factsheet of the OSCE Border Management Staff College</a></strong><br /><br /><strong><span style="font-size: 11px; color: #aaaaaa;">14 June 2013</span></strong>

Tried:

<td valign="top" width="620"><strong><a style="font-size:14px;" href="images/pub/pub1.pdf" target="_self">Factsheet of the OSCE Border Management Staff College</a></strong><br /><br /><strong><span style="font-size: 11px; color: #aaaaaa;">14 June 2013</span></strong>

Nothing changed;

<td valign="top" width="620"><strong><a class="pub" href="images/pub/pub1.pdf" target="_self">Factsheet of the OSCE Border Management Staff College</a></strong><br /><br /><strong><span style="font-size: 11px; color: #aaaaaa;">14 June 2013</span></strong>

a.pub
{
font-size: 14px;
}

No changes;

<td class="pub" valign="top" width="620"><strong><a  href="images/pub/pub1.pdf" target="_self">Factsheet of the OSCE Border Management Staff College</a></strong><br /><br /><strong><span style="font-size: 11px; color: #aaaaaa;">14 June 2013</span></strong>

td.pub
{
font-size: 14px;
}

No effects; It is using font of a tag from style.css file I want to change font-size for only this a tag. Any ideas what I am doing wrong?

Upvotes: 14

Views: 121848

Answers (3)

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201528

You should analyze your style.css file, possibly using Developer Tools in your favorite browser, to see which rule sets font size on the element in a manner that overrides the one in a style attribute. Apparently, it has to be one using the !important specifier, which generally indicates poor logic and structure in styling.

Primarily, modify the style.css file so that it does not use !important. Failing this, add !important to the rule in style attribute. But you should aim at reducing the use of !important, not increasing it.

Upvotes: 1

sangram parmar
sangram parmar

Reputation: 8726

use this attribute in style

font-size: 11px !important;//your font size

by !important it override your css

Upvotes: 1

Mr. Alien
Mr. Alien

Reputation: 157284

Strange it doesn't change, as inline styles are most specific, if style sheet has !important declared, it wont over ride, try this and see

<span style="font-size: 11px !important; color: #aaaaaa;">Hello</span>

Upvotes: 35

Related Questions