04-CSS3文本与字体
text-outline
text-outline: thickness blur color; //规定文本轮廓
//任何主流浏览器都不支持 text-outline
word-break
word-break: normal | break-all | keep-all; //规定自动换行的处理方法
normal:正常,一个英文单词放不下就不放
break-all:到了该换行的地方就换行,一个英文单词放不下就放前面几个字母,换行后继续接着
keep-all:到半角标点符号的地方换行或空格
//在中文中normal跟break-all是一样的,中文不存在一个字分成两半的情况。
word-wrap
word-wrap: normal | break-word; //允许 长单词 或 长url地址 换行到下一行
normal:长单词或url太长会产生溢出,不会进行换行。
break-word:长单词或url太长,到了该换行的时候都会自动换行。
text-align-last:
text-aligh-last: auto | left | right | center | justify | start | end | initial | inherit; //规定文本最后一行的对齐方式
initial:默认对齐
inherit:继承
//Firefox浏览器加前缀-moz
text-overflow
text-overflow: clip | ellipsis | string; //这个属性必须加上overflow:hidden,不然的话它溢出部分都会直接显示,导致这个属性失去效果。
clip:多出的部分直接剪掉
ellipsis:多出的部分用…表示
//'abc'(string)表示多出的部分用abc表示,abc为任意字符串。
字体
@font-face
@font-face { font-family: <YourDefineFontName>; //字体名称 src: <url> [<format>],[<source> [<format>]], *; //字体存放路径,可多个 [font-weight: <weight>]; [font-style: <style>]; }
@font-face兼容性模板(字蛛)
@font-face {
font-family: 'pinghei';
src: url('../font/pinghei.eot');
src:
url('../font/pinghei.eot?#font-spider') format('embedded-opentype'),
url('../font/pinghei.woff') format('woff'),
url('../font/pinghei.ttf') format('truetype'),
url('../font/pinghei.svg') format('svg');
font-weight: normal;
font-style: normal;
}
//到了需要引用字体的时候,直接font-family:“字体名”。
字体转换:www.fontsquirrel.com/tools/webfont-generator