htmldiv重叠问题,原因分析和处理
1、现象
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>重叠DIV</title>
<style>
.left{width:200px; float:left; color:#F00; border:1px solid #F00}
.nofloat{width:100px; background:#CCC}
</style>
</head>
<body>
<div class="left">left对象DIV内</div>
<div class="nofloat">nofloat对象DIV内</div>
</body>
</html>
div border属性2原因分析
class=left的div盒⼦使⽤了浮动属性float:left,⽽class=nofloat未使⽤。这样⼀个浮动DIV,⼀个未使⽤float浮动属性,所以就造成重叠现象。
3、解决⽅法
(1)清除样式
(2)2个都⽤浮动,或者都不⽤。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。