CSS布局 通栏平均分布型

    xiaoxiao2024-10-28  66

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>通栏平均分布型</title> <style> * { margin: 0; padding: 0; } .top { /* 通栏的盒子 可以不用写宽度 默认的宽度和浏览器一样宽 */ height: 80px; border: 1px dashed #aaa; background-color: #eee; text-align: center; } .banner { width: 960px; height: 150px; border: 1px dashed #aaa; background-color: #eee; text-align: center; margin: 8px auto; } .small { margin-bottom: 10px; width: 960px; height: 100px; /* border: 1px dashed #aaa; background-color: gray; */ text-align: center; margin: 8px auto; } ul { list-style: none; } .small ul li { width: 230px; border: 1px dashed #aaa; background-color: #eee; height: 100px; float: left; margin-left: 10px; } .small ul .nomargin { /* 注意: 必须加权重 */ margin-left: 0; } .footer { height: 150px; border: 1px dashed #aaa; background-color: #eee; margin-top: 10px; } </style> </head> <body> <div class="top">顶部通栏</div> <div class="banner">banner</div> <div class="small"> <ul> <li class="nomargin">1</li> <li>2</li> <li>3</li> <li>4</li> </ul> </div> <div class="small"> <ul> <li class="nomargin">1</li> <li>2</li> <li>3</li> <li>4</li> </ul> </div> <div class="small"> <ul> <li class="nomargin">1</li> <li>2</li> <li>3</li> <li>4</li> </ul> </div> <div class="footer"></div> </body> </html>

    最新回复(0)