css 自定义字体
第一:在css中引入@font-face,使用font-family设置自己想要取的字体名称,这里我取作mikasaTong(当然也可以是xxFont等)。
第二:下载字体
1) .ttf (True Type Fonts) 和 .otf (OpenType Fonts) :
Firefox、Chrome、Safari 、Opera
2).eot (Embedded OpenType)
Internet Explorer 9+
当然,我们也可以通过字体转换来得到eot。TTF to EOT Font Converter
示例:
<!DOCTYPE html> <html> <head> <title></title> <style type="text/css"> @font-face{ font-family:"mikasaTong"; src:url('IndieFlower.ttf'),url('IndieFlower.eot'); } body{ font-family: "mikasaTong"; } </style> </head> <body> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </body> </html>