CSS3中新增的对文本和字体的设置

文字阴影

text-shadow: 水平偏移 垂直偏移  模糊 颜色

兼容性:IE10+

<!DOCTYPE html>
<html lang="en" manifest="index.manifest"headmeta charset="UTF-8"title>Document</style>
    p{
        color:blue;
        text-shadow 3px 3px 3px black;
    }

body>
    p>这是一段测试文本鸭html>

 

 css3 换行

word-break: normal | break-all | keep-all

对于英文文本:normal 和 keep-all 效果相同;break-all 即字母和字母见换行,不考虑单词的影响

对于中文文本:normal 和 break-all 效果相同;keep-all 即根据标点符号换行

width500px}
    spanbackground#abcdef
    p:nth-child(1)word-breaknormal
    p:nth-child(2)break-all
    p:nth-child(3)keep-all

    p:nth-child(5)
    p:nth-child(6)
    p:nth-child(7)}
><span>[word-break:normal]> I have a dream that one day on the red hills of Georgia,the sons of former slaves and the sons of former slave owners will be able to sit down together at the table of brotherhood.>[word-break:break-all]>[word-break:keep-all]hr> 我梦想有一天,这个国家会站立起来,真正实现其信条的真谛:“我们认为人人生而平等的真理不言而喻。”我梦想有一天,在佐治亚的红山上,从前奴隶的后嗣将能够和奴隶主的后嗣坐在一起,共叙兄弟情谊。> 我梦想有一天,这个国家会站立起来,真正实现其信条的真谛:“我们认为人人生而平等的真理不言而喻。”我梦想有一天,在佐治亚的红山上,从前奴隶的后嗣将能够和奴隶主的后嗣坐在一起,共叙兄弟情谊。.>

 

 word-wrap 针对连续的英文长单词或者url网址(中文无效)

word-wrap:normal | break-word;

200pxword-wrapbreak-word>[word-wrap:normal]> br>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>[word-wrap:break-word]>

>

 

 text-align-last  文本最后一行如何对齐

只有IE支持,火狐需要加-moz-前缀,谷歌50+支持

800pxtext-align-lastautoleftright
    p:nth-child(4)center
    p:nth-child(5)justifystart
    p:nth-child(8)initial
    p:nth-child(9)inherit>auto>HTML称为超文本标记语言,是一种标识性的语言。它包括一系列标签.通过这些标签可以将网络上的文档格式统一,使分散的Internet资源连接为一个逻辑整体。HTML文本是由HTML命令组成的描述性文本,HTML命令可以说明文字,图形、动画、声音、表格、链接等。>left>right>center>justify>start>end>initial>inherit>

 

 text-align-last 只在text-align:justify 时才有效

text-overflow

使用时需要设置元素为overflow:hidden;

中文无效,英文短单词无效,只对英文长单词有效


    divoverflowhidden
    div:nth-child(1)text-overflowclip
    div:nth-child(2)ellipsis
    div:nth-child(3)">>"
    div:nth-child(4)
    div:nth-child(5)
    div:nth-child(6)
    div:nth-child(7)
    div:nth-child(8)
    div:nth-child(9)div>clip>ellipsis>string>

    >I have a dream that one day on the red hills of Georgia,1)">>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>


>

 

 text-overflow:clip;  隐藏

text-overflow:ellipsis;  省略号

text-overflow:string;  指定字符,只在火狐浏览器有效

>

 

 overflow: visible | hidden | scroll | auto | inherit

鼠标悬浮时显示隐藏的文字


    div:hovervisible>

 

 

@font-face 兼容性 IE9+

字体格式

TrueType   .ttf   无优化 兼容性IE9+

OpenType   .otf  是ttf的升级版,不兼容IE

.woff    web版本最佳字体格式  是TrueType/OpenType的压缩格式  兼容性IE9+  但是不能兼容手机端!

.eot   IE专用字体格式

.svg    svg字体格式  IE和火狐都不兼容

自定义字体通用模板


    @font-face
        font-family"myFont"
        srcurl('font/myFont.eot'),/*兼容IE9+*/
            url('font/myFont.eot?#iefix') format('embedded-opentype'),1)">兼容IE6-8
            url('font/myFont.ttf') format('truetype'),1)">兼容手机端
            url('font/myFont.woff') format('woff'),1)">兼容所有浏览器
            url('font/myFont.svg#myFont') format('svg')针对ios开发*/

    font-family 'myFont';} 

>

>这是我的自定义字体呀~>

>

获取特殊字体的网站:https://www.fontsquirrel.com/tools/webfont-generator

 

 

 

 由于是国外服务器,因此下载速度比较慢

注意:经我个人发现,这个软件转换出来的字体格式,都只支持英文版

建议还是使用其他国内的在线转换工具或者网址

 

字体文件

 

 


    @font-face  '杨任东竹石体'url('myfont/杨任东竹石体.eot'),1)">
            url('myfont/杨任东竹石体.eot?#iefix') format('embedded-opentype'),1)">
            url('myfont/杨任东竹石体.ttf') format('truetype'),1)">
            url('myfont/杨任东竹石体.woff') format('woff'),1)">
            url('myfont/杨任东竹石体.svg#杨任东竹石体') format('svg')*/
    font-size24px>HELLO THIS IS MY FONT~这是我的自定义字体~>

 

成功~~~

 

相关文章

Css常用的排序方式权重分配 排序方式: 1、按类型&#160;...
原文:https://www.cnblogs.com/wenruo/p/9732704.html 先上...
css属性:word-wrap:break-word; 与 word-break:break-all 的...
https://destiny001.gitee.io/color/
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML...
css之background的cover和contain的缩放背景图 对于这两个属...