Rumah  >  Artikel  >  hujung hadapan web  >  如何在谷歌浏览器下设置小于12px的字体_html/css_WEB-ITnose

如何在谷歌浏览器下设置小于12px的字体_html/css_WEB-ITnose

WBOY
WBOYasal
2016-06-24 11:32:221571semak imbas

如果在谷歌浏览器下设置小于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/

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn