Font-size being ignored in browsers

狂风中的少年 提交于 2020-01-04 13:46:30

问题


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 ?


回答1:


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.




回答2:


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

.myclass {
  font-size: 0.8em !important; 
}


来源:https://stackoverflow.com/questions/7025993/font-size-being-ignored-in-browsers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!