How to set a fixed font size/ prevent browser scaling for a specific single element?

别等时光非礼了梦想. 提交于 2019-12-14 02:35:08

问题


I want the font in my navigation bar to be a fixed size - not affected by browser font size changes. I'm totally fine with the rest of the text being fluid but the design of my site is such that i need the nav bar text to remain the same size no matter what.

Here is an example of what i would LIKE to do. Don't know how this was done. The nav bar on the top right is unaffected by font size increase/decrease. If someone could clue me in it would be greatly appreciated! :)

http://studiogang.net/

Also, I don't want to use an image instead, because the dropdown menu i want won't work with image mapping. Or at least, i'd rather not go down that road.


回答1:


<ul id="navbar" style="font-size:14px">

</ul>



回答2:


You can try using text-size-adjust:

 -webkit-text-size-adjust:none;
 -ms-text-size-adjust:none;
 -moz-text-size-adjust:none;
 text-size-adjust:none;

It only works on mobile though.

Apart from that I think the only option is to make your layout working well on different zoom levels.




回答3:


Try using pixels for the font size.



来源:https://stackoverflow.com/questions/19918286/how-to-set-a-fixed-font-size-prevent-browser-scaling-for-a-specific-single-elem

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