CSS字体怎么用

html-css024

CSS字体怎么用,第1张

CSS字体用法,首先我们需要去下载你所要用的字体,网页的话建议你最好还是使用大家都有的字体,如宋体等等,然后,我们在通过css的font-family:"字体名字",来设置就好了,这里通过代码来理解下:

<html>

<head>

<style>

.wenzi{

width:200px

height:100px

border:1px solid #f00

font-family:"宋体" //这是只是举例,字体你可以自行去设定

}

</head>

<body>

<div class='wenzi'>

<p>我的数据</p>

</div>

</body>

</html>

http://www.fontsquirrel.com/tools/webfont-generator

在线字体转换,你会需要的,通常下载下来的字体确实只有一种,我们需要通过其他工具转换得到我们需要的兼容其他浏览器的字体格式

www.w3cplus.com/content/css3-font-face

参考博客,相信你更需要~~

你在eot后面加一个?#iefix试试,我之前也做过css嵌入字体,而且各个浏览器测试也没什么问题,我当时的写法是这样的

@font-face

{

font-family:

'steiner'

src:

url('steiner.eot')

src:

url('steiner.eot?#iefix')

format('embedded-opentype'),

url('steiner.woff')

format('woff'),

url('steiner.ttf')

format('truetype'),

url('steiner.svg#steiner')

format('svg')

font-weight:

normal

font-style:

normal

}

你可以对比一下,另外可以看看在url里面加单引号会不会解决问题。