zoukankan      html  css  js  c++  java
  • css3文本省略换行,添加字体

    <!DOCTYPE html>
    <html>
    <head>
    <title>文本省略,添加字体</title>
    <meta charset="utf-8">
    <style type="text/css">
    div{
    font-family: myFont;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    /*做到文本溢出以省略号代替的效果是text-overflow: ellipsis来决定的,但是它需要overflow: hidden;
    white-space: nowrap;来配合*/
    }
    /*font-family可以设置文本字体,比如font-family: "微软雅黑"等
    如果想使用第三方字体就需要使用@font-face来创建自定义字体然后用font-family: myFont引用
    字体是区分中文和英文的*/
    @font-face{
    font-family: myFont;
    src:url("fonts/SingleMalta.ttf");
    }

    </style>
    </head>
    <body>
    <div>can i use here hhhh hhhh hhhh hhhhh hhh kkkk kkkkk dad dasd wewe ewewe ewewds dad dsds</div>
    </body>
    </html>

  • 相关阅读:
    优先队列用法详解
    chenzl
    2020面向对象程序设计寒假作业1
    1.自我介绍

    洛谷U32670 小凯的数字(比赛)
    洛谷1417 烹调方案
    高等软工课程总结
    西电B楼导航
    毕业前夕随想
  • 原文地址:https://www.cnblogs.com/adialike/p/6383749.html
Copyright © 2011-2022 走看看