无为清净楼资源网 Design By www.qnjia.com
下面这段CSS在IE中好好的,但在GOOGLE Chrome中总是不行,我调测了无数次。问题就出在 clearBoth 这个样式上,本来这个样式是做为换行用的清除DIV浮动状态的样式,在IE7中正常,但在GOOGLE Chrome却空出很大一块,不知道是什么原因?
代码如下:

复制代码代码如下:
<html>
<head>
<style>
.userInfo
{
width: 430px;
height: 300px;
border: 1px solid #eee;
float: left;
}
.chartPanel
{
border: 1px solid #eee;
height: 300px;
margin: 0 0 0 440px;
}
.clearBoth
{
clear: both;
}
</style>
</head>
<body>
<div class="userInfo">
</div>
<div class="chartPanel">
<div style="float: left;">
sasadf</div>
<div class="clearBoth">
</div>
<div style="float: left;">
sasabbbbbbbbbbbbbbbbbbbbbdf</div>
</div>
<div class="clearBoth">
</div>
<div class="userInfo">
</div>
<div class="chartPanel">
<div style="float: left; height: 40px; background: red;">
aaa</div>
<div style="float: left; height: 40px; background: blue;">
bbbbbbbbbbbbb</div>
<div class="clearBoth">
</div>
<div style="float: left; height: 40px; background: yellow;">
aaa</div>
<div style="float: left; height: 40px; background: green;">
bbbbbbbbbbbbb</div>
</div>
</body>
</html>

如下的样式:

复制代码代码如下:
.chartPanel
{
border: 1px solid #eee;
height: 300px;
margin: 0 0 0 440px;
float:left;
}

上面的样式加上float:left;就可以解决这个问题,但需要请调整margin的数值到所需要的值,它是以它左边的那个userinfo为参考点,多个元素在一行应该都要定义float排列在一行,同一行的那两个div应该用一个大的div包起来,还有就是如果要换行,直接对需要换行的元素定义clear:both;就好了,没必要加一个
这样的元素在那,有时候我们加这个元素是为撑开兼容才用的。
详解代码如下:

复制代码代码如下:
<!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>
<title></title>
<style type="text/css">
.userInfo
{
width: 430px;
height: 300px;
border: 1px solid #eee;
position:absolute;
left:0;
top:0;
}
.chartPanel
{
border: 1px solid #eee;
height: 300px;
margin: 0 0 0 440px;
}
.clearBoth
{
clear: both;
}
.outbox{clear:both; float:left; width:100%; position:relative;margin-bottom:10px; }
.red{ float:left;height:40px; background:red;}
.blue{ float:left;height:40px; background:blue;}
.yellow{float:left; height:40px; background:yellow;}
.green{ float:left;height: 40px; background:green;}
</style>
</head>
<body>
<div class="outbox">
<div class="userInfo">
</div>
<div class="chartPanel">
<div>
sasadf
</div>
<div class="clearBoth">
sasabbbbbbbbbbbbbbbbbbbbbdf
</div>
</div>
</div>
<div class="outbox">
<div class="userInfo">
</div>
<div class="chartPanel">
<div class="clearBoth">
<div class="red">
aaa
</div>
<div class="blue">
bbbbbbbbbbbbb
</div>
</div>
<div class="clearBoth">
<div class="yellow">
aaa
</div>
<div class="green">
bbbbbbbbbbbbb
</div>
</div>
</div>
</div>
</body>
</html>
标签:
clearBoth,Chrome

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。