CSS & Style Notes

字符溢出隐藏style

style="width:200px;
    overflow: hidden; //溢出部分隐藏
    text-overflow: ellipsis; //溢出部分用省略号代替,可选
    white-space: nowrap; "//不换行,可选

font简写

一、字体属性主要包括下面几个

font-style,font-variant,font-weight,font-size,line-height, font-family,

font-style(字体样式):normal(正常)、italic(斜体)或oblique(倾斜);

font-variant(字体变化):normal(正常)或small-caps(小体大写字母);

font-weight(字体浓淡):normal(正常)或bold(加粗)。有些浏览器甚至支持采用100到900之间的数字(以百为单位);

font-size(字体大小):可通过多种不同单位(比如像素或百分比等)来设置,如:12px,12pt,120%,1em;

line-height(文字行高):normal(默认)、<实数>(字体的倍数)、<长度>(px)、<百分比>(字体的百分比)、inherit;

font-family(字体族):“Arial”、“Times New Roman”、“宋体”、“黑体”等。 

如果用 font 属性的话,就可以把几个样式进行简化,减少书的情况;font 属性的值应按以下次序书写(各个属性之间用空格隔开):

顺序:font-style | font-variant | font-weight | font-size | line-height | font-family

二、font的简写实例

.font{

font-style: italic;

font-variant: small-caps;

font-weight: bold;

font-size: 12px;

line-height: 1.5em;

font-family: arial,verdana;

}

.font {font: italic small-caps bold 12px/1.5em arial,verdana;}

三、font的简写注意事项

1、简写时,font-size和line-height只能通过斜杠/组成一个值,不能分开写。

2、顺序不能改变。这种简写方法只有在同时指定font-size和font-family属性时才起作用。而且,如果你没有设定font-weight, font-style, 以及 font-varient ,他们会使用缺省值

 

posted on 2017-08-14 11:29  呼呼net  阅读(116)  评论(0编辑  收藏  举报

导航