总结
CSS的语法缩写总结
一 颜色
16进制的色彩值,如果每两位的值相同,可以缩写一半
#000000 = #000;
#336699 = #369;
二 盒尺寸
有一个值时上下左右的尺寸一样:(top,right,bottmo,left)
margin:1em;
padding:1em;
有两个值时是上下取第一个值,左右取第二个值:(top,bottom)–>(left,right)
margin:1em 0;
有三个值时是上,左右,下 top–>(left,right)->bottom
margin:1em 0 2em;
有四个值时模型尺寸赋值是顺时针的,也就是top–>right–>bottom–>left;
margin:1em 0 2em 0.5em;
三 边框(border)
border-width:1px; border-style:solid; border-color:#000;
可以缩写成
border:1px solid #000;
语法是: border:width style color;
四 背景(Backgrounds)
background-color:#f00; background-image:url(background.gif); background-repeat:no-repeat; background-attachment:fixed; background-position:0 0;
可以缩写成
background:#f00 url(background.gif) no-repeat fixed 0 0;
语法是: background:color image repeat attachment position;
可以省略其中一个或多个属性值,如果省略,该属性值将用浏览器默认值,默认值为
color: transparent image: none repeat: repeat attachment: scroll position: 0% 0%
字体(fonts)
字体的属性如下:
font-style:italic; font-variant:small-caps; font-weight:bold; font-size:1em; line-height:140%; font-family:"Lucida Grande",sans-serif;
可以缩写为一句:
font:italic small-caps bold 1em/140% "Lucida Grande",sans-serif;
注意,如果你缩写字体定义,至少要定义font-size和font-family两个值。
列表(lists)
取消默认的圆点和序号可以这样写
list-style:none;,
list的属性如下:
list-style-type:square; list-style-position:inside; list-style-image:url(image.gif);
可以缩写为一句:
list-style:square inside url(image.gif);
标签云
.htaccess 301 2010 Android apache cache cacti CSS date ddos discuz django fastcgi freebsd git google http iftop linux macos mysql nginx njava php pr python sed seo snmp ssh ubuntu ubuntu10.04 wordpress xdebug 优化 密码 文件 时区 用户 登录 监控 缓存 网站 脚本 颜色
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.
近期文章
近期评论
文章归档
链接表
QR Code
