css 定位屬性position的使用方法執行個體-----一個層疊視窗

來源:互聯網
上載者:User

標籤: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的使用方法執行個體-----一個層疊視窗

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.