展会信息港展会大全

css学习笔记之CSS缩写笔记
来源:互联网   发布日期:2016-03-25 15:52:08   浏览:1667次  

导读:CSS缩写可以很大可能的提升我们网站制作与编写上的速度了,下面我来给大家整理一些常用的关于CSS缩写的常用命令,希望对大家会有所帮助。字体font:font-style | font-va...

CSS缩写可以很大可能的提升我们网站制作与编写上的速度了,下面我来给大家整理一些常用的关于CSS缩写的常用命令,希望对大家会有所帮助。

字体

font:font-style | font-variant | font-weight | font-size | line-height | font-family ;

Margin & Padding

magin: magin-top | margin-right | margin-bottom | margin-left;

P {magin:20px;}

P {magin:20px 10px;}

P {magin:20px 10px 100px;} 上边距20px,左右10px,下边距100px

边框

border:border-width | border-style | color

border-top:border-width | border-style | color

border_right:border-width | border-style | color

border-bottom:border-width | border-style | color

border-left:border-width | border-style | color

border-width: top | right | bottom | left

border-color: top | right | bottom | left

border-style: top | right | bottom | left

支持1-4个参数的缩写

List 列表缩写list-style:list-style-type | list-style-position | list-style-image

Background 缩写

background: background-color | background-image |background-repeat | background-attachment | background-position

color 缩写

颜色

16进制的色彩值,如果每两位的值相同,可以缩写一半,例如:

#000000可以缩写为#000;#336699可以缩写为#369;

盒尺寸

通常有下面四种书写方法:

property:value1; 表示所有边都是一个值value1;

property:value1 value2; 表示top和bottom的值是value1,right和left的值是value2

property:value1 value2 value3; 表示top的值是value1,right和left的值是value2,bottom的值是value3

property:value1 value2 value3 value4; 四个值依次表示top,right,bottom,left

方便的记忆方法是顺时针,上右下左。具体应用在margin和padding的

例子如下:

margin:1em 0 2em 0.5em;

CSS 内补距(CSS padding):

padding-top:5px; padding-bottom:10px; padding-left:15px; padding-right:20px;

即可缩写为

padding:5px 20px 10px 15px; 或padding-top:5px; padding-bottom:5px; padding-left:10px; padding-right:10px;缩写为padding:5px 10px;

CSS 外边距(CSS margin):

margin-top:5px; margin-bottom:10px; margin-left:15px; margin-right:20px;

即可缩写为

margin:5px 20px 10px 15px; 或margin-top:5px; margin-bottom:5px; margin-left:10px; margin-right:10px;缩写为margin:5px 10px;

赞助本站

人工智能实验室

相关热词: 开发 编程 android

AiLab云推荐
推荐内容
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港