IE6下span右浮动换行解决方法
摘要:IE6下span右浮动换行怎么处理:在编写新闻列表的时候,一般要求左边是新闻标题,右边是新闻发布时间。时间一般会放在标签中,并将其右浮动。代码如下:蚂蚁部落 蚂蚁部落欢迎您2012-12-13 大家好,好久不见了2012-12-13 蚂蚁部落2012-12-13 以上代码在I...
IE6下span右浮动换行怎么处理:
在编写新闻列表的时候,一般要求左边是新闻标题,右边是新闻发布时间。时间一般会放在<span>标签中,并将其右浮动。
代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.51texiao.cn/" />
<title>蚂蚁部落</title>
<style type="text/css">
li{
list-style-type:none;
font-size:12px;
color:blue;
width:300px;
height:30px;
line-height:30px;
border-bottom:1px dashed blue;
}
span{
color:red;
width:60px;
height:30px;
float:right;
}
</style>
</head>
<body>
<div>
<ul>
<li><a href="#">蚂蚁部落欢迎您</a><span>2012-12-13</span></li>
<li><a href="#">大家好,好久不见了</a><span>2012-12-13</span></li>
<li><a href="#">蚂蚁部落</a><span>2012-12-13</span></li>
</ul>
</div>
</body>
</html>
以上代码在IE8或者FF浏览器中是正常的,但是在IE6浏览器中时间却换行了。
解决方案:将<a>标签和<span>标签分别浮动起来,分别左右浮动即可。代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.51texiao.cn/" />
<title>蚂蚁部落</title>
<style type="text/css">
li{
list-style-type:none;
font-size:12px;
color:blue;
width:300px;
height:30px;
line-height:30px;
border-bottom:1px dashed blue;
}
a{
width:240px;
height:30px;
float:left;
}
span{
color:red;
width:60px;
height:30px;
float:right;
}
</style>
</head>
<body>
<div>
<ul>
<li><a href="#">蚂蚁部落欢迎您</a><span>2012-12-13</span></li>
<li><a href="#">大家好,好久不见了</a><span>2012-12-13</span></li>
<li><a href="#">蚂蚁部落</a><span>2012-12-13</span></li>
</ul>
</div>
</body>
</html>
相关文章
最新发布
阅读排行
热门文章
猜你喜欢