css中图片上浮有字体可以改字体类型吗

html-css08

css中图片上浮有字体可以改字体类型吗,第1张

css中图片上浮有字体可以改字体类型吗,css如何修改字体样式?

在CSS中,可以通过font-family属性来修改字体样式。

font-family 规定元素的字体系列。

font-family 可以把多个字体名称作为一个“回退”系统来保存。如果浏览器不支持第一个字体,则会尝试下一个。也就是说,font-family 属性的值是用于某个元素的字体族名称或/及类族名称的一个优先表。浏览器会使用它可识别的第一个值。

有两种类型的字体系列名称:

指定的系列名称:具体字体的名称,比如:"times"、"courier"、"arial"。

通常字体系列名称:比如:"serif"、"sans-serif"、"cursive"、"fantasy"、"monospace"

css引入外部字体

@font-face{font-family: 'YaHei Consolas Hybrid' src : url('../fonts/yaheiconsolashybrid.ttf')}body{font-family: 'YaHei Consolas Hybrid' font-size: 16px background: url(../img/bgContent.png) repeat}12345678910

不同浏览器字体的格式有差别

字体后缀和浏览器有关,如下所示

* .TTF或.OTF,适用于Firefox 3.5、Safari、Opera * .EOT,适用于Internet Explorer 4.0+

* .SVG,适用于Chrome、IPhone 比如:@font-face {font-family: 'HansHandItalic' src: url('fonts/hanshand-webfont.eot') src: url('fonts/hanshand-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/hanshand-webfont.woff') format('woff'), url('fonts/hanshand-webfont.ttf') format('truetype'), url('fonts/hanshand-webfont.svg#webfont34M5alKg') format('svg') font-weight: normal font-style: normal}