css 相关属性

来源:互联网 发布:python hdfs3 编辑:程序博客网 时间:2024/05/19 00:38

1.font-family-设置字体

如:

font-family:宋体;  //系统默认有宋体,黑体,微软雅黑和幼园等;


2.font-size-设置文字大小

如:

font-size:20px; 

//常用文字绝对大小单位:in英寸、cm厘米、mm毫米;

//常用文字相对大小单位:px像素、%百分比;


3.color属性-颜色选择

基本语法:color:颜色值;

有三种定义颜色方式:

                                      1、color:rgba(0,0,0,.1); //rgb表示三原色,值取0-255.a表示透明度;

                                      2、color:#eee; //十六进制,每一种颜色对应一种颜色;

                                      3、color:red;  //颜色名 ,直接快捷;

目前大多数开发软件都有color-picker可以直接调用颜色,但要想在前端这块做好,还是需要一些常用颜色的十六进制表达式或三原色搭配;


4.font-weight属性-文字加粗

如:font-weight:bold;

//常搭配的有 normal正常(400)、 bold加粗(700)、 bolder超级粗、 lighter细、 inhert继承父、 100~900自定义;


5.font-style属性-文字样式,包括正常、斜体、偏斜体

如:font-style:normal;

//常搭配的有normal正常、 italic斜体、 oblique倾斜;


6.text-transform属性-英文字体大小写

如:text-transform:属性值;

//相关属性值:capitalize首字母大写、 uppercase全部大写、 lowercase全部小写;


7.text-decoration属性-字体下划线上划线删除线

如:text-decoration:属性值;

//相关属性值:underline下划线、overline上划线、 line-throught删除线,可以同时使用;


8.letter-spacing-文字间距

如:letter-spacing:0.5em;


9.line-height属性-文字间距

如:line-height:9px;


10.text-indent属性-段落文字中首行缩进

如:text-indent:24px;


11.text-align属性-文字水平对齐方式

如:text-align:属性值;

//相关属性值:left、right、center、justify(两端对齐)


12.vertical-align属性-文字垂直对齐方式

如:vertical-align:t属性值;

//相关属性:top bottom center等

原创粉丝点击