网页中通过CSS的font-family属性,来定义字体的,页面默认中文是宋体,也可只定义一个英文Arial即可。
方法如下:
body {font-family: Arial, "宋体"
}
补充:
font 简写:
body { font:italic small-caps bold 12px/1.5em Arial, "宋体"}等效于:
body {font-style:italic
font-variant:small-caps
font-weight:bold
font-size:12px
line-height:1.5em
font-family:arial,verdana
}
顺序:font-style | font-variant | font-weight | font-size | line-height | font-family
简写时,font-size和line-height只能通过斜杠/组成一个值,不能分开写。
<html><head>
<style type="text/css">
a.top:link {font-family: 宋体} /*链接字体*/
a.top:link {font-weight: normal} /*设置链接文字中的字符粗细*/
a.top:link {font-size: 12} /*设置链接文字的大小*/
a.top:link {text-decoration: none} /*设置链接文字没有下划线*/
a.top:hover {text-decoration: underline} /*鼠标放在链接上时有下划线*/
a.top:link {color: #000000} /*设置链接文字的颜色*/
a.top:visited {color: #000000} /*访问过的链接*/
a.top:hover {color: #B50000} /*鼠标放在链接上字体的颜色*/
a.tj:link {font-family: 宋体}
a.tj:link {font-weight: normal}
a.tj:link {font-size: 12}
a.tj:link {text-decoration: none}
a.tj:hover {text-decoration: none}
a.tj:link {color: #000000}
a.tj:visited {color: #0000ff}
a.tj:hover {background: #FFFFCC}
h1 {font-size:12px}
h1 {font-family: "宋体"}
h1 {font-weight: normal}
h1 {color: #000000}
h2 {font-size:14px}
h2 {font-family: "宋体"}
h2 {font-weight: normal}
h2 {color: #000000}
h3 {font-size:24px}
h3 {font-weight: 1}
h3 {color: #000000}
body {
margin-top: 1px /*上边距*/
margin-bottom: 1px /*下边距*/
}
</style>
<meta http-equiv="Content-Type" content="text/html charset=gb2312"></head>
<body>
<p>Mouse over the links to see them change layout.</p>
<p><b><a href="default.asp" target="_blank" class="top">电脑对怀孕其实没啥影响</a></b></p>
<p><b><a href="default.asp" target="_blank" class="tj">电脑对怀孕其实没啥影响</a></b></p>
<h1>电脑对怀孕其实没啥影响</h1>
<h2>电脑对怀孕其实没啥影响</h2>
<h3>电脑对怀孕其实没啥影响</h3>
</body>
</html>
以下为font-family常用合集以及一部分文字效果:
windows常见内置中文字体
宋体 SimSun
黑体 SimHei
微软雅黑 Microsoft YaHei
微软正黑体 Microsoft JhengHei
新宋体 NSimSun
新细明体 PMingLiU
细明体 MingLiU
标楷体 DFKai-SB
仿宋 FangSong
楷体 KaiTi
仿宋_GB2312 FangSong_GB2312
楷体_GB2312 KaiTi_GB2312
宋体:SimSuncss中中文字体(font-family)的英文名称
Mac OS的一些:
华文细黑:STHeiti Light [STXihei]
华文黑体:STHeiti
华文楷体:STKaiti
华文宋体:STSong
华文仿宋:STFangsong
俪黑 Pro:LiHei Pro Medium
俪宋 Pro:LiSong Pro Light
标楷体:BiauKai
苹果俪中黑:Apple LiGothic Medium
苹果俪细宋:Apple LiSung Light
Windows的一些:
新细明体:PMingLiU
细明体:MingLiU
标楷体:DFKai-SB
黑体:SimHei
新宋体:NSimSun
仿宋:FangSong
楷体:KaiTi
仿宋_GB2312:FangSong_GB2312
楷体_GB2312:KaiTi_GB2312
微软正黑体:Microsoft JhengHei
微软雅黑体:Microsoft YaHei
装Office会生出来的一些:
隶书:LiSu
幼圆:YouYuan
华文细黑:STXihei
华文楷体:STKaiti
华文宋体:STSong
华文中宋:STZhongsong
华文仿宋:STFangsong
方正舒体:FZShuTi
方正姚体:FZYaoti
华文彩云:STCaiyun
华文琥珀:STHupo
华文隶书:STLiti
华文行楷:STXingkai
华文新魏:STXinwei
font-family,好看常用的字体
例1(小米米官网):font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif
例2(淘宝技术研发中心):font: 12px/1.5 Tahoma,Helvetica,Arial,'宋体',sans-serif
例3(加网 ):font: 14px/1.5 'Microsoft YaHei',arial,tahoma,\5b8b\4f53,sans-serif
例4(淘宝UED):font: 12px/1 Tahoma,Helvetica,Arial,"\5b8b\4f53",sans-serif
例5(一淘UX):font-family: Helvetica, 'Hiragino Sans GB', 'Microsoft Yahei', '微软雅黑', Arial, sans-serif