css中的一些問題及解決方案

來源:互聯網
上載者:User

標籤:作用   屬性   strong   margin   nbsp   現象   解決   lock   oat   

1.margin的各種問題

  (1)豎向margin的疊加

    margin橫向上是加法,但在豎向上卻會產生疊加的現象,並會取上下間 距的其大者生效。

  (2)margin對列標籤的影響

    行屬性標籤直接設定margin時,橫向起作用,豎向無效

  (3)margin-top的bug

    當兩個容器嵌套時,如果外層容器和內層容器之間沒有別的元素,有些瀏覽器會把內層元素的margin-top作用與父元素。

      (解決:浮動、display:inline-block、虛擬元素、邊框、padding-top)

  (4)IE6下的橫向雙倍margin bug

      IE6會在特定的條件下,將設定的橫向margin值變成雙倍。

      條件: 1.元素必須浮動(float);

      2.元素必須具有橫向margin 即 margin-left、margin-right

      3.元素必須是塊元素

        4.瀏覽器必須是ie6

        解決:display:inline;

 

css中的一些問題及解決方案

聯繫我們

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