css入門003

來源:互聯網
上載者:User

標籤:line   position   order   clear   play   padding   isp   繼承   block   

盒子模型盒子盒子關係(標準文檔流)
  • 行內元素:只可以設定左右外邊距,上下內邊距會影響相鄰的元素
  • 塊狀元素:兩個垂直的margin會合并,大的margin起作用(margin塌陷 )
  • 元素嵌套的時候,設定在子項目上的margin會被父元素搶走,解決方案:設定父元素border或者父元素overflow
屬性的繼承問題
  • 文本類,字型,顏色,子項目會繼承父元素的屬性
  • 布局類,邊距,大小,邊距,背景不會繼承
定位相對定位
  • 相對於自身原先的位置
絕對位置
  • 相對於前面一個定位的祖先元素,直到html
固定定位
  • 相對於螢幕
布局的相關屬性尺寸
  • width
  • max-width
  • min-width
  • height
  • max-height
  • min-height
內邊距(補白/內補白)
  • padding
  • padding-left
  • padding-right
  • padding-top
  • padding-bottom
外邊距(邊距/外部白)
  • margin
  • ......
布局的相關屬性
  • display none/block/inline/inline-block
  • visibility hidden/visible/collapse
  • overflow hidden/visible/auto/scroll
  • overflow-x
  • overflow-y
  • float:left/right
  • clear:清除浮動對後面的影響 both/left/right
    • 例:<br >
    • overflow:auto;
定位屬性
  • position:static(預設值)/relative(相對定位)/absolute(絕對位置)/fixed(固定定位)

  • 三個定位的優先順序一樣

  • left
  • right
  • top
  • bottom
  • z-index 顯示優先順序。只能設定給已經定位的元素
隱藏元素
  • visibility:hidden;隱藏了元素,但位置還在
  • display:none;位置和元素均隱藏了

css入門003

相關文章

聯繫我們

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