1哟忍、盒子模型的平面結(jié)構(gòu):
這就是每個網(wǎng)頁的基本盒子模型:從內(nèi)到外元素組成:
1、外邊距:margin ?2自点、盒子邊框:border ?
3生音、盒子內(nèi)邊距:padding ?4韩脏、盒子內(nèi)容:content
其中margin缩麸、border、padding分別有四個方向?qū)傩裕簍op骤素、right匙睹、bottom、left;
其中的border存在三個屬性济竹,常用簡寫:border{1px solid red}
border屬性:
div{
border-width:2px;
border-style:solid;
border-color:red;
}
padding順序?qū)懭胍弧⒍薄⑷妥恰⑺膫€值的含義:(margin與之類似)
padding:10px;? ? ? ? ? ? ? ? ? ? ? ? ? ?四個內(nèi)邊距都是10px
padding:5px?10px;? ? ? ? ? ? ? ? ? 上下5px?左右10px
padding:5px?10px?15px;? ? ? ? ? ? ?上5px?右10px?下15px? ?左因為缺省與右相等,則為10px
padding:5px?10px?15px?20px;? ? ?上5px?右10px?下15px? 左20px
2丘跌、盒子模型的3D立體結(jié)構(gòu):
盒子模型從上到下顯示為5層:
1袭景、邊框:border
2、內(nèi)容和內(nèi)邊距:content+padding
3闭树、背景圖片:background-image
4耸棒、背景色:background-color
5、外邊距:margin
這樣就很容易理解
background: url(../images/logo.gif)
img(src(../images/logo.gif))
背景圖片與插入圖片層次為背景圖片在下了报辱。