absolute:??定位
relative:相?定位,?absolute配搭,?定relative通常是父的概念
View Code
1 2 3 4 5 6 三?式版面 7 8 #wrapper { 9 width: 100%; /* ?定???度 */10 }11 #header {12 background-color: #DDDDDD;13 height: 50px;14 }15 #container {16 position: relative;17 margin: 10px 0;18 width: 100%;19 }20 #primary {21 margin: 0 200px; /* ?定左右?界155px */22 background-color: #C7D5ED;23 }24 #secondary {25 position: absolute;26 left: 0px;27 top: 0px;28 width: 145px; /* ?定???度 */29 background-color: #F9CFBA;30 }31 #advertisement {32 position: absolute; /* ?配置方式值指定?absolute */33 right: 0px; /* 指定???右?的距? */34 top: 0px; /* 指定???上方的距? */35 width: 145px; /* ?定???度 */36 background-color: #E5C7ED;37 }38 #footer {39 background-color: #DDDDDD;40 height: 50px;41 }42 43 44 45 4647
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did102818