標籤:weight 運行 ima png 效果 標準 需要 body z-index
運行結果:
<!DOCTYPE html><html><head><title>重疊樣式視窗</title><style type="text/css">div.window{/*指定視窗的尺寸和邊框*/position:absolute;/*position在其他地方指定*/width: 300px; /*視窗尺寸,不含邊框*/height: 200px;border: 3px outset gray;/*注意3D “outset”邊框效果*/}div.titlebar{/*指定標題列的定位、尺寸和樣式*/position: absolute;/*他是定位元素*/top:0px;height: 18px;/*標題列18px+內邊距和邊框*/width:290px;/*290+5px 左右內邊距 = 300*/background-color: #aaa;/*標題列顏色*/border-color: groove gray 2px;/*標題列只有底部邊框*/padding: 3px 5px 2px 5px;/*順時針值:top right bottom left*/font:bold 11pt sans-serif;/*標題列字型*/}div.content{/*指定視窗內容的尺寸、定位和滾動*/position: absolute;/*他是定位元素*/top: 25px;/*18px標題+2px邊框+3px+2px內邊距*/height: 165px;/*200px總共 - 25px標題列-10px*/width:290px;/*300px寬度-10px內編劇*/padding: 5px;/*4條邊上都有空間*/overflow: auto;/*如果需要,則顯示捲軸*/background-color: #fff;/*預設白色背景*/}div.translucent{/*此類讓視窗部分透明*/opacity: .75;/*透明度標準樣式*/filter: alpha(opacity=75);/*IE的透明度*/}</style></head><body><!-- 定義一個視窗:“window” div友誼個標題列和其內是以個內容div。注意,如何設定定位一個擴充了樣式的style屬性 --><div class="window" style="left:10px; top:10px; z-index: 10"><div class="titlebar">測試視窗</div><div class="content">1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>……1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br></div></div><!-- 定義另一視窗;用不容的定位、顏色和字型重量 --><div class="window" style="left:75px; top:110px; z-index: 20"><div class="titlebar">另一個測試視窗</div><div class="content translucent" style="background-color: #ccc;font-weight: bold;">這是另一個視窗地區</div></div></body></html>
css 定位屬性position的使用方法執行個體-----一個層疊視窗