网页上的菜单页面通常使用无序列表来完成,无序列表标准语法:
- ........
- ........
- ........
- ........
- ..
- 成一行,li标签里面可以插入其他标签 下面是用无序列表做的菜单页面
<div id="all"> <div class="biao"><h2>家用电器</h2></div> <h3>大家电</h3> <ul> <li><a href="">平板电脑</a> <a href="">洗衣机</a> <a href="">冰箱</a></li> <li><a href="">空调</a> <a href="">烟机/灶具</a> <a href="">热水器</a></li> <li><a href="">冷柜/酒柜</a> <a href="">消毒柜</a> <a href="">家庭影院</a></li> </ul> <h3>生活电器</h3> <ul> <li><a href="">电风扇</a> <a href="">净化器</a> <a href="">吸尘器</a></li> <li><a href="">净水设备</a> <a href="">挂烫机</a> <a href="">电话机</a></li> </ul> <h3>厨房电器</h3> <ul> <li><a href="">榨汁机</a> <a href="">电压力锅</a> <a href="">电饭煲</a></li> <li><a href="">豆浆机</a> <a href="">微波炉</a> <a href="">电磁炉</a></li> </ul> <ul> <h3>五金家装</h3> <li><a href="">淋浴/水槽</a> <a href="">电动工具</a> <a href="">手动工具</a></li> <li><a href="">仪器仪表</a> <a href="">浴霸/排气</a> <a href="">灯具</a></li> </ul> </div> 使用的css 如下 *{ padding: 0px; margin: 0px; } #all{ width: 250px; height: 450px; border: 1px solid black; margin: auto; } h2{ color: aliceblue; font-size: 20px; text-indent: 2em; } .biao{ background-color:rgb(15, 124, 191) ; height: 40px; line-height: 40px; } h3{ height: 30px; line-height: 30px; background-color: rgb(228, 241, 250); font-size: 16px; text-indent: 35px; color: rgb(15,124,191); } li{ height: 30px; line-height: 30px; list-style: none; margin-left: 30px; } a{ text-decoration: none; color: lightslategrey; font-size: 14px; } a:hover{ color: coral; text-decoration: underline; } 做出来的效果如下图 