首頁  >  文章  >  web前端  >  IE6下span右浮动换行怎么处理_html/css_WEB-ITnose

IE6下span右浮动换行怎么处理_html/css_WEB-ITnose

WBOY
WBOY原創
2016-06-24 11:41:451076瀏覽

IE6下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浏览器中时间却换行了。
解决方案:将标签和标签分别浮动起来,分别左右浮动即可。代码如下:

<!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>

原文地址:http://www.51texiao.cn/div_cssjiaocheng/2015/0429/419.html

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn