当前位置:Gxlcms > css > 详解css3文字与字体样式

详解css3文字与字体样式

时间:2021-07-01 10:21:17 帮助过:33人阅读

这篇文章详解css3文字与字体样式

css3使用服务器端字体:

  1. <!DOCTYPE html><html lang="en"><head>
  2. <meta charset="UTF-8">
  3. <title>使用服务器端字体</title>
  4. <style>
  5. @font-face {
  6. font-family: webFont;
  7. /*此代码会首先用客户端字体Arial,如果客户端没有用下面一种服务器端字体*/
  8. /*format格式: (ttf):truetype;(otf):opentype*/
  9. src:local("Arial"),
  10. url("../../font/ACaslonPro-Bold.otf")format("opentype");
  11. }
  12. p{
  13. font-family: webFont;
  14. }
  15. </style></head><body><p>This is a test p</p></body></html>


css3修改字体种类而保持字体尺寸不变:

  1. <!DOCTYPE html><html lang="en"><head>
  2. <meta charset="UTF-8">
  3. <title>CSS3 修改字体种类而保持字体尺寸不变</title>
  4. <style>
  5. /*x-height:58px; font-size:100px; aspect:0.58; font-size-adjust: 0.56;*/
  6. #p1{
  7. font-family:"Arial Black";
  8. font-size: 16px;
  9. font-size-adjust: 0.76;
  10. }
  11. #p2{
  12. font-family:"Arial";
  13. font-size: 16px;
  14. font-size-adjust: 0.56;
  15. }
  16. #p3{
  17. font-family:"Bodoni MT";
  18. font-size: 16px;
  19. font-size-adjust: 0.46;
  20. }
  21. </style></head><body><p id="p1">this isa test p1</p><p id="p2">this isa test p2</p><p id="p3">this isa test p3</p></body></html>

以上就是详解css3文字与字体样式的详细内容,更多请关注Gxl网其它相关文章!

人气教程排行