CSS教程:所有浏览器中都能正常显示的字体
很佩服国外一些前端开发人员对待学问的研究精神,他们很善于总结发现。看到一篇关于安全字体List of Web Safe Fonts的文章,里面总结了所有的安全字体的样式,当然都是英文的。
所谓安全字体,就是在所有的浏览器中都能正常显示的字体,也就是所有操作系统默认都安装了的字体。
共有21种安全字体:
font-family: Arial, Helvetica, sans-serif;
font-family: 'Arial Black', Gadget, sans-serif;
font-family: 'Bookman Old Style', serif;
font-family: 'Comic Sans MS', cursive;
font-family: Courier, monospace;
font-family: 'Courier New', Courier, monospace;
font-family: Garamond, serif;
font-family: Georgia, serif;
font-family: Impact, Charcoal, sans-serif;
font-family: 'Lucida Console', Monaco, monospace;
font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif;
font-family: 'MS Sans Serif', Geneva, sans-serif;
font-family: 'MS Serif', 'New York', sans-serif;
font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
font-family: Symbol, sans-serif;
font-family: Tahoma, Geneva, sans-serif;
font-family: 'Times New Roman', Times, serif;
font-family: 'Trebuchet MS', Helvetica, sans-serif;
font-family: Verdana, Geneva, sans-serif;
font-family: Webdings, sans-serif;
font-family: Wingdings, 'Zapf Dingbats', sans-serif;
我们用一个页面形象的展示出来:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>安全字体</title>
<style type="text/css">
<!--
* { font-size:12px}
div { padding:5px 0; border-bottom:1px solid #ccc}
P { margin:3px 0}
.font_arial {font-family: Arial, Helvetica, sans-serif}
.font_arialblack {font-family: 'Arial Black', Gadget, sans-serif;}
.font_bookman {font-family: 'Bookman Old Style', serif;}
.font_comic {font-family: 'Comic Sans MS', cursive;}
.font_courier {font-family: Courier, monospace;}
.font_couriernew {font-family: 'Courier New', Courier, monospace;}
.font_garamond {font-family: Garamond, serif;}
.font_georgia {font-family: Georgia, serif;}
.font_impact {font-family: Impact, Charcoal, sans-serif;}
.font_lucida_c {font-family: 'Lucida Console', Monaco, monospace;}
.font_lucida_s {font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif;}
.font_mssans {font-family: 'MS Sans Serif', Geneva, sans-serif;}
.font_msserif {font-family: 'MS Serif', 'New York', sans-serif;}
.font_palatino {font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;}
.font_symbol {font-family: Symbol, sans-serif;}
.font_tahoma {font-family: Tahoma, Geneva, sans-serif;}
.font_times {font-family: 'Times New Roman', Times, serif;}
.font_trebuchet {font-family: 'Trebuchet MS', Helvetica, sans-serif;}
.font_verdana {font-family: Verdana, Geneva, sans-serif;}
.font_webdings {font-family: Webdings, sans-serif;}
.font_wingdings {font-family: Wingdings, 'Zapf Dingbats', sans-serif;}
-->
</style>
</head>
<body>
<div class="font_arial">
<p>这是字体:font-family: Arial, Helvetica, sans-serif</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_arialblack">
<p>这是字体:font-family: 'Arial Black', Gadget, sans-serif</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_bookman">
<p>这是字体:font-family: 'Bookman Old Style', serif</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_comic">
<p>这是字体:font-family: 'Comic Sans MS', cursive</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_courier">
<p>这是字体:font-family: Courier, monospace</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_couriernew">
<p>这是字体:font-family: 'Courier New', Courier, monospace</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_garamond">
<p>这是字体:font-family: Garamond, serif</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_georgia">
<p>这是字体:font-family: Georgia, serif</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_impact">
<p>这是字体:font-family: Impact, Charcoal, sans-serif</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_lucida_c">
<p>这是字体:font-family: 'Lucida Console', Monaco, monospace</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_lucida_s">
<p>这是字体:font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
</div>
<div class="font_mssans">
<p>这是字体:font-family: 'MS Sans Serif', Geneva, sans-serif</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_msserif">
<p>这是字体:font-family: 'MS Serif', 'New York', sans-serif</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_palatino">
<p>这是字体:font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_symbol">
<p>这是字体:font-family: Symbol, sans-serif</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_tahoma">
<p>这是字体:font-family: Tahoma, Geneva, sans-serif</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_times">
<p>这是字体:font-family: 'Times New Roman', Times, serif</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_trebuchet">
<p>这是字体:font-family: 'Trebuchet MS', Helvetica, sans-seriff</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_verdana">
<p>这是字体:font-family: Verdana, Geneva, sans-serif</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_webdings">
<p>这是字体:<br />
font-family: Webdings, sans-serif</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
<div class="font_wingdings">
<p>这是字体:<br />
font-family: Wingdings, 'Zapf Dingbats', sans-serif</p>
<p>中文和英文混排test</p>
<p>ABCDEFGHIJKLMNOPQRSTUVWXYZ</p>
<p>abcdefghijklmnopqrstuvwxyz</p>
<p>0123456789</p>
</div>
</body>
</html>
IE7下截图:
以前常常在烦恼中英文混排的问题,英文字体一般都是选用亚洲字体或者Verdana字体,可在和中文混排的时候都不是很理想,偶然看到一篇淘宝兄弟的blog,他建议用Tahoma字体,而且发现淘宝网很快的改用了这种字体。从我上面的截图也可以看出,Tahoma字体在12px下中英文混排是看上去最舒服的。