如果在谷歌浏览器下设置小于12px的字体:
建议:尽可能的手写代码,可以有效的提高学习效率和深度。
在谷歌浏览器有一个由来已久的问题,那就是无法设置小于12px字体,就算是设置了小于12px的字体也只会显示12px大小。
先看一段代码实例:
<!DOCTYPE html><html><head><meta charset=" utf-8"><meta name="author" content="http://www.softwhy.com/" /><title>蚂蚁部落</title><style type="text/css">ul{ list-style:none;}.first{ font-size:16px; }.second{ font-size:14px; }.third{ font-size:12px; }.fourth{ font-size:10px; }</style></head><body><ul> <li class="first">16px</li> <li class="second">14px</li> <li class="third">12px</li> <li class="fourth">10px</li></ul></body></html>
以上代码在谷歌浏览器中并不能将字体大小设置为10px。下面就对上面的代码进行一下修改:
<!DOCTYPE html><html><head><meta charset=" utf-8"><meta name="author" content="http://www.softwhy.com/" /><title>蚂蚁部落</title><style type="text/css">html,body{ -webkit-text-size-adjust:none;}ul{ list-style:none;}.first{ font-size:16px; }.second{ font-size:14px; }.third{ font-size:12px; }.fourth{font-size:10px; }</style></head><body><ul> <li class="first">16px</li> <li class="second">14px</li> <li class="third">12px</li> <li class="fourth">10px</li></ul></body></html>
以上代码实现了将字体大小设置为10px的功能。核心是添加了如下代码:
html,body{ -webkit-text-size-adjust:none;}
原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=3375
更多内容可以参阅:http://www.softwhy.com/divcss/
立即学习“前端免费学习笔记(深入)”;
谷歌浏览器Google Chrome是一款可让您更快速、轻松且安全地使用网络的浏览器。Google Chrome的设计超级简洁,使用起来得心应手。这里提供了谷歌浏览器纯净安装包,有需要的小伙伴快来保存下载体验吧!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号