如何防止HTML / CSS上的文本大小增加 [英] How do prevent text size increase on html/css
问题描述
这个网站看起来很不错,虽然它设法阻止用户通过浏览器设施增加/减少字体大小。
this website looks very nice, although the've managed to prevent the user to increase/decrease the font size through the browser facility.
如果您在浏览器上选中缩放文字选项,并尝试放大或缩小(通常是⌘+ /⌘-或Ctrl + / strong>,您可以看到字体大小不会改变。
If you check the Zoom Text Only option on your browser and try to zoom in or zoom out (usually ⌘+ / ⌘- or ctrl+ / ctrl-) you can see that the font-size doesn't change.
如何复制相同的效果?
我认为这将是很好防止项目从菜单或纯基于布局的元素,只留下主要文本受到影响。
I am thinking that this would be nice to prevent items from menu or purely layout based elements and leave only the main text be affected.
推荐答案
从查看他们的CSS,它可能是这行代码: -webkit-text-size-adjust:none;
只能在有限数量的浏览器中工作,而不是在任何地方。
From looking at their CSS, it might be this line of code: -webkit-text-size-adjust:none;
If so, it'd only work in a limited number of browsers, not everywhere.
但是,没有太多理由阻止用户调整文本大小。是的,它可能会导致设计问题,但您也可以认为设计应该足够灵活以处理字体大小更改。
There's not much reason you should be preventing users from adjusting text size, though. Yes, it might cause problems with the design, but you could also argue that the design should be flexible enough to deal with font size changes.
喜剧选项:带有图片的文字。
Comedy option: replace all your text with images.
这篇关于如何防止HTML / CSS上的文本大小增加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!