淺談margin負值的作用

來源:互聯網
上載者:User
本文主要和大家淺談margin負值的作用,我們在CSS中都會使用margin,但將margin設定成負數,那可能就不大好處理了,margin負值並非hack,margin負值遵循文檔流;假如使用margin負值促使一個元素向上位移,那麼相關元素也會隨之發生位移;margin負值能良好相容各瀏覽器。

1.有倆個邊框,有不同的背景色,不管哪邊高增加,另一邊也變高

2、實現自適應

相關文章

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.