css定位:絕對位置(absolute)

來源:互聯網
上載者:User

標籤:style   blog   http   io   ar   color   os   使用   sp   

絕對位置的概念
1.使用絕對位置的盒子以它的”最近”一個”已經定位”的“祖先元素”為基準進行位移。如果沒有已經定位的祖先元素,那麼可以以瀏覽器的視窗為基準進行定位。
2.決定定位的框從標準流中脫離。

<html> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ /> <title>無標題文檔</title> <style type=”text/css”>body{ margin:15px; font-family:Arial; font-size:12px; } .father{ background-color:#ffff99; border:1px solid #000000; padding:20px; } .father div{ background-color:#00ff00; padding:10px; border:1px dashed #000000; } #block2{ position:absolute; left:30; top:20; } </style> </head> <body> <div class=”father”> <div>Box-1</div> <div id=”block2″>Box-2</div> <div>Box-3</div> </div> </body> </html>

css定位:絕對位置(absolute)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.