css如何用ul li 排成两行两列 并且第二行合并
发布网友
发布时间:2022-04-21 01:28
我来回答
共3个回答
热心网友
时间:2022-04-21 02:57
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
ul, li { list-style:none; padding:0; }
ul { width:500px; height:300px; margin:50 auto; background:#CCC }
li { float:left; height:30px; line-height:30px; margin-left:10px; background:#E6E6E6; margin-bottom:10px; }
.li1 { width:240px; }
.li2 { width:230px; }
.li3 { width:260px; }
p { margin:10px auto; }
</style>
</head>
<body>
<ul>
<li class="li1">第三个li宽240px</li>
<li class="li2">第三个li宽230px</li>
<li class="li3">第三个li宽260px</li>
</ul>
<p>li浮动,然后设置li款酷。上面两个li加起来宽度小于ul宽度,三个li加起来宽度大于ul宽度</p>
</body>
</html>
热心网友
时间:2022-04-21 04:15
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
div{ border-bottom:1px solid red; padding:0px; width:200px; }
ul{ list-style:none; margin:0px; padding:0px;}
li { list-style:none; border:1px solid red; border-bottom:none; margin:0px; padding:0px;}
-->
</style>
</head>
<body>
<div>
<ul>
<li style="float:left;">我爱我的家</li><li>我爱我的家</li>
</ul>
<ul><li>我爱我的家我爱我的家</li></ul>
</div>
</body>
</html>
热心网友
时间:2022-04-21 05:50
ul
ul li
<ul>
<li>1</li>
<li>2</li>
...
<li>100</li>
</ul>