div如何竖着排列 换行??

lijing3333 2011-10-20 09:18:32
比如现在有div是这样的效果

div
div
div
div
div
div
div
div

但是他不会换成第2排 我要的效果是
div div
div div
div div
div div
div
div
div

这样如何实现 貌似不会换到第2排呢
...全文
1988 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Gemini Dean 2011-10-20
  • 打赏
  • 举报
回复
控制div宽度就可以,width="300px"
zjtpiaoxue 2011-10-20
  • 打赏
  • 举报
回复
方法一:给每排定义宽度,刚好能够显示得下两个div
方法二:用表格布局吧,最简单不过了
lijing3333 2011-10-20
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 ssdltwp 的回复:]

HTML code
<!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-equi……
[/Quote]

是这样 3q了
鸟先生 2011-10-20
  • 打赏
  • 举报
回复
<!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=utf-8" />
<title>无标题文档</title>
<style>
.test,.test1{ float:left; border:1px solid #333333;}
</style>
</head>

<body>
<div class="test">
<div>111111111111111111</div>
<div>222222222222222222</div>
<div>333333333333333333</div>
<div>444444444444444444</div>
<div>555555555555555555</div>
<div>666666666666666666</div>
<div>777777777777777777</div>
</div>
<div class="test1">
<div>111111111111111111</div>
<div>222222222222222222</div>
<div>333333333333333333</div>
<div>444444444444444444</div>
</div>
</body>
</html>


是这样吗 , 不是说清楚点。。。
rao3324180 2011-10-20
  • 打赏
  • 举报
回复
float:left;width:50%;你试试
潮起潮落 2011-10-20
  • 打赏
  • 举报
回复
在列上定义一个大div,类为col。
先排列方向上的,再排行方向上的。

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧