How can I solve this clear off inconsistency in Firefox and IE7?
When I am clearing an element in Firefox4,it goes to the next line leaving some spacing in between a开发者_StackOverflow社区nd in IE7, it goes to the next line without leaving any space..
<!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>Untitled Document</title>
<style type="text/css">
#a{border:#000 thin groove;float:left;}
#b{border:#000 thin groove;float:left;clear:left;}
</style>
</head>
<body>
<p id="a">Testing</p>
<p id="b">Testingb</p>
</body>
</html>
Most browsers now have a default margin-top
and margin-bottom
greater than zero for p
elements. Internet Explorer doesn't.
Adding p { margin: 0; }
to your styles will fix it.
精彩评论