html css中的浮动问题,问个菜鸟DIV浮动问题_html/css_WEB-ITnose

5268f80b9b1e01f982625ef6fac83ca1.png

ss

3510.png

CSS里面是这样的

#main

{

margin:12px 0px 0px 0px;

width:100%;

height:600px;

}

#main-left

{ width:660px;

height:553px;

float:left;

}

#main-right1

{

width:300px;

height:100px;

}

问题来了,为什么main-right1不会在main-left的右边围绕着,而是在main-left的下面,甚至溢出了main这个DIV。。

如果把 width:300px;max-height:100px;删掉,main-right1就围绕在main-left的右边

回复讨论(解决方案)

另外,你的main DIV的width是100%;当浏览器缩小时,肯定会有溢出的。。。

简单调试了下:你看看,中间那个红色的可以当作空白来用.

tiaoshi :在调试的时候用的,可以选择性的删掉.#main{margin:12px 0px 0px 0px;width:100%;height:600px;}#main-left{ width:660px; height:553px; padding:auto; margin:auto; background-color:#cccccc;/*tiaoshi*/ float:left;}#blank{ /*tiaoshi*/width:10px;height:100px;float:left;margin:auto;background-color:red;/*tiaoshi*/}#main-right1{ width:300px; height:100px; padding:auto; margin:auto; background-color:blue;/*tiaoshi*/}

ss

s

ss

如果div里面不是图片的话,可以围绕在main-left的右边。。这个我知道。。

你试试这样:在main-left中加入display:block;在main-right1中加入float:right;

你在#main-right1里面加个float:left,或者将两个div的宽度缩小一些。

1428d0e076c3959ab11d28a39bc84fab.png

5268f80b9b1e01f982625ef6fac83ca1.png

本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉

本文系统来源:php中文网

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值