div1和div2两个外围div的间距该如何控制

phpcainiao 2010-09-29 03:46:07
各位啊,

div1里面套了多个div。然后另外一个div2里面也套了多个div

请问div1和div2两个外围div的间距该如何控制,,为什么我做的div1和div2的间距在 IE6和IE8下面显示不一样,IE6的好像翻倍了。
...全文
381 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
natici 2010-09-30
  • 打赏
  • 举报
回复
根据lz的代码,在ie6和ff下测试均没有上下边距。
zhaoyongkissyou 2010-09-29
  • 打赏
  • 举报
回复
如果是间距的翻倍的问题 你给每个DIV设置一个 display:inline;就行了
yingying901029 2010-09-29
  • 打赏
  • 举报
回复
我这里没有上下边距!把你spacing 和roll的代码也贴出来
phpcainiao 2010-09-29
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 yingying901029 的回复:]
.news_center { margin-left:4px; margin-right:2px; height:290px; width:348px; float:left;display:inline; background:black;}


这里有左边距 所以才会有间隙!
[/Quote]

左右边距我是要的,

我是说上下边距。。。<div class="news"><div class="roll">这两个标签的上下间距。
yingying901029 2010-09-29
  • 打赏
  • 举报
回复
.news_center { margin-left:4px; margin-right:2px; height:290px; width:348px; float:left;display:inline; background:black;}


这里有左边距 所以才会有间隙!
zhanzhao1989 2010-09-29
  • 打赏
  • 举报
回复
<margin>
yingying901029 2010-09-29
  • 打赏
  • 举报
回复
你这没内容 杂看啊?
phpcainiao 2010-09-29
  • 打赏
  • 举报
回复
news,roll {margin:0; padding:0;float:left; overflow:hidden;}

还有这个,忘记了贴了。。。
phpcainiao 2010-09-29
  • 打赏
  • 举报
回复
.news_center { margin-left:4px; margin-right:2px; height:290px; width:348px; float:left;display:inline;}
.news_center_up {height:35px; width:348px; background-image:url(news_center_up.jpg); background-repeat:no-repeat;}
.news_center_middle {height:251px; width:348px; background-image:url(news_center_middle.jpg); background-repeat:repeat-y;}
.news_center_down {height:4px; width:348px; background-image:url(news_center_down.jpg); background-repeat:no-repeat;}
.news_right { margin-left:4px; margin-right:5px; height:290px; width:254px; float:left;display:inline;}
.news_right_up {height:27px; width:254px; background-image:url(news_right_up.jpg); background-repeat:no-repeat;}
.news_right_middle {height:258px; width:254px; background-image:url(news_right_middle.jpg); background-repeat:repeat-y;}
.news_right_down {height:5px; width:254px; background-image:url(news_right_down.jpg); background-repeat:no-repeat;}
.roll_up_left { height:31px; width:8px; background-image:url(roll_up_left.jpg); background-repeat:no-repeat; float:left;display:inline;}
.roll_up_center {height:31px; width:980px; background-image:url(roll_up_center.jpg); float:left;display:inline;}
.roll_up_right {margin-right:2px; height:31px; width:9px; background-image:url(roll_up_right.jpg); background-repeat:no-repeat; float:left;display:inline;}
.roll_middle {width:999px; height:150px; background-image:url(roll_middle.jpg);}
.roll_down {width:999px; height:5px; background-image:url(roll_down.jpg); background-repeat:no-repeat;}
natici 2010-09-29
  • 打赏
  • 举报
回复
css也一同贴出,只有html还不能确定lz想要什么效果。
phpcainiao 2010-09-29
  • 打赏
  • 举报
回复
如果是吧<div class="news"><div class="roll">里面套的div去掉,那两者的间距在IE6和IE8下面都正常,请问该怎么写css。
phpcainiao 2010-09-29
  • 打赏
  • 举报
回复
<div class="news"> 和 <div class="roll">的间距,在IE6下面非常高。
phpcainiao 2010-09-29
  • 打赏
  • 举报
回复
<div class="news"><!--news start-->
<div class="news_left"></div>
<div class="news_center">
<div class="news_center_up"></div>
<div class="news_center_middle"></div>
<div class="news_center_down"></div>
</div>
<div class="news_right">
<div class="news_right_up"></div>
<div class="news_right_middle"></div>
<div class="news_right_down"></div>
</div>
<div class="both"></div>
</div><!--news end-->
<div class="spacing"></div><!--spacing start and end-->
<div class="roll"><!--roll start-->
<div class="roll_up_left"></div>
<div class="roll_up_center"></div>
<div class="roll_up_right"></div>
<div class="roll_middle"></div>
<div class="roll_down"></div>
<div class="both"></div>
</div><!--roll end-->
yingying901029 2010-09-29
  • 打赏
  • 举报
回复
把你代码贴出来
phpcainiao 2010-09-29
  • 打赏
  • 举报
回复
问题是我没有设置间距,也起码有十多个像素的间距。
yingying901029 2010-09-29
  • 打赏
  • 举报
回复
复制一个你写的间距 然后在后面的加个下划线,值改成原来的一半!


例如padding-left:20px;_padding-left:10px;

61,126

社区成员

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

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