margin:10px 0 2px 5px
。
边框
(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%
明确定义单位,除非值为
0
忘记定义尺寸的单位是很容易忽略的错误。在
HTML 中可以只写 width=100,但是在
CSS 中,必须给一个准确的单位,比如:width:100px width:100em。只有两个例外
情况可以不定义单位:行高和
0 值。除此以外,其它值都必须紧跟单位,注意,不要在数值
和单位之间加空格。
正确使用
class 前的元素限定
input.login_btn{}
限定了
.login_btn 只有在 input 标签内才是有效的。