盒子模型實戰,盒子實戰

來源:互聯網
上載者:User

盒子模型實戰,盒子實戰

開門見山,先來一張:

我寫的盒子模型只要修改一個參數就可以控制一行圖片放幾張,每張間的間距等等。

還是直接上代碼。

box.html

<meta charset="UTF-8"/><title>盒子模型2</title><link rel="stylesheet" type="text/css" href="box2.css"></head><body><!-- div1在布局中起到一個控制整個內容顯示的位置作用 --><div class="div1"><!-- ul在布局中作用是可以控制顯示內容的多少 --><ul class="faceul"><li><img src="2.PNG"/></li><li><img src="2.PNG"/></li><li><img src="2.PNG"/></li><li><img src="2.PNG"/></li><li><img src="2.PNG"/></li><li><img src="2.PNG"/></li></ul></div></body></html>

box2.css

.div1{width: 900px;height: 300px;border: 1px solid blue;margin: 5px 0px 0px 5px;/*padding-top: 80px;*?  /* 注意:padding會將盒子撐破 */padding-left: 0px;}.faceul{width: 500px; /* 控制一行有幾個 */height: 250;border: 1px solid red;padding-left: 0px; /* 讓li可以靠近ul */margin-left: 5px;}.faceul li{list-style-type: none;float: left; /* 左浮動 */width: 100px;height: 100px;border: 1px solid red;margin-right: 5px;margin-top: 5px;}.faceul li img{width: 90px;height: 90px;margin-left: 5px;margin-top: 5px;}

大家可以試著修改參數,然後看效果,我覺得這樣學習是最快的!

聯繫我們

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