2

I'm trying to set the font size of a table cell, but its not working. I've tried to set size in the css:

.myclass {
  font-size: 10px; 
}

It didn't work. I tried to change it to a relative size:

.myclass {
  font-size: 0.8em; 
}

But it didn't worked either. When i looked at the element using google chrome Developer tools, the font-size tag was there, but was striked out and has a yellow exclamation mark next to it. Does anybody know what it means and how can i set the font size ?

Marlon
  • 1,719
  • 3
  • 20
  • 42
  • Post your html as well, there is something wrong for sure. –  Aug 11 '11 at 12:41
  • I have noticed that this value may be ignored if you make it smaller than a certain size. I was experimenting with this in Chrome devtools today and noticed it wouldn't let me make some fonts smaller than 12px. – toxicantidote Feb 09 '22 at 00:36

2 Answers2

3

If you used a more specific selector to set the font before, the less specific selector won't work. Try to begin with general rules and use the specifics after them.

Hugo Mota
  • 11,200
  • 9
  • 42
  • 60
  • might be that, but i solved it using % instead of em. font-size: 85% worked perfectly, and I can still folow the users browsers size configuration. – Marlon Aug 13 '11 at 13:06
2

Try adding !important following the declaration of the style. This will override any other styles.

.myclass {
  font-size: 0.8em !important; 
}
Trevor
  • 11,269
  • 2
  • 33
  • 40
  • 2
    http://stackoverflow.com/questions/3427766/should-i-avoid-using-important-in-css/3427813#3427813 –  Aug 11 '11 at 12:48
  • its just that people tend to misuse power, so please don't arm them :D –  Aug 11 '11 at 13:31