a标签在ie6和ie7下面换行显示问题解析
2012-05-28 21:35
316 查看
此问题为ie6和ie7的一个bug,在ie其他的版本或者ff,maxthon、chrome下都为正常的。
只要是非浮动元素在浮动元素之前,并且是同行的时候,这个问题就会出现, ie6、ie7效果一致,
可以看到不在同一行现实,像是被挤下来了一样。代码是这样的
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<style type="text/css">
.aa{float:right;width:50px;height:20px;diaplay:block;color:#096;}
</style>
<body>
<div style="width:300px;height:20px;color:#096;">
<span>2012.05.8</span>
<a href="###" class="aa">回复</a>
<a href="###" class="aa">删除</a>
</div>
</body>
</html>
解决办法有两个:
1、改变非浮动元素和浮动元素的位置,将浮动元素放在前面。像这样:
<div style="width:300px;height:20px;color:#096;">
<a href="###" class="aa">回复</a>
<a href="###" class="aa">删除</a>
<span>2012.05.8</span>
</div>
2、给非浮动元素也加上浮动,加上 span{float:left;}
<html>
<head>
<title>无标题文档</title>
</head>
<style type="text/css">
.aa{float:right;width:50px;height:20px;diaplay:block;color:#096;}
span{float:left;}
</style>
<body>
<div style="width:300px;height:20px;color:#096;">
<span>2012.05.8</span>
<a href="###" class="aa">回复</a>
<a href="###" class="aa">删除</a>
</div>
</body>
</html>
这个经典bug,不难,但是开发大型的交互产品时这是个问题要特别注意。
只要是非浮动元素在浮动元素之前,并且是同行的时候,这个问题就会出现, ie6、ie7效果一致,
可以看到不在同一行现实,像是被挤下来了一样。代码是这样的
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<style type="text/css">
.aa{float:right;width:50px;height:20px;diaplay:block;color:#096;}
</style>
<body>
<div style="width:300px;height:20px;color:#096;">
<span>2012.05.8</span>
<a href="###" class="aa">回复</a>
<a href="###" class="aa">删除</a>
</div>
</body>
</html>
解决办法有两个:
1、改变非浮动元素和浮动元素的位置,将浮动元素放在前面。像这样:
<div style="width:300px;height:20px;color:#096;">
<a href="###" class="aa">回复</a>
<a href="###" class="aa">删除</a>
<span>2012.05.8</span>
</div>
2、给非浮动元素也加上浮动,加上 span{float:left;}
<html>
<head>
<title>无标题文档</title>
</head>
<style type="text/css">
.aa{float:right;width:50px;height:20px;diaplay:block;color:#096;}
span{float:left;}
</style>
<body>
<div style="width:300px;height:20px;color:#096;">
<span>2012.05.8</span>
<a href="###" class="aa">回复</a>
<a href="###" class="aa">删除</a>
</div>
</body>
</html>
这个经典bug,不难,但是开发大型的交互产品时这是个问题要特别注意。
相关文章推荐
- 解决IE6,IE7,IE8换行显示问题
- 在IE6 下span标签换行问题解决--》 'white-space:nowrap' 仅作用在纯文本内容上
- JS控制显示隐藏兼容问题(IE6、IE7、IE8)
- IE6、IE7的a标签下划线问题
- title 与 meta标签顺序问题,造成在IE和360浏览器下面显示为空白页的问题。
- CSS问题1:div中 li宽度不固定 ie6和ie7不兼容不自动换行
- div在IE6与IE7下显示高度不兼容的问题
- IE6、IE7浮动层被下面的动挡住的问题
- 关于jquery解析json数据时动态追加tr 指定条数换行问题 实现list的 并列显示效果
- Colortip基于jquery的信息提示框插件在IE6下面的显示问题修正方法
- JS控制显示隐藏兼容问题(IE6、IE7、IE8)
- (转)写的html页面引用外部css文件的时候在IE7,IE8和FF中能正常作用,即能正常显示,可在IE6中却完全没有作用到,即css文件里的样式根本未被解析到我们的html页面,这是什么原因?
- meta 标签代码解决IE兼容问题,IE6,IE7,IE8,IE9,IE10(包括360的兼容模式)
- 修正一下jQuery插件Colortip在IE6下面的显示问题
- IE6 下JS改变IMG标签SRC不显示的问题[终级方法]
- js实现图片上传前的预览,实现完美兼容Firefox3,IE6,IE7,IE8和IE9的显示问题
- 深入解析HTML的table表格标签与相关的换行问题
- IE6和IE7中<a>标签宽高设置无效的问题
- IE6、IE7、IE8 JS控制显示隐藏兼容问题
- 一个BUG显示了IE7和IE6解析URL中中文参数能力的不同