首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > CSS >

span中背景图去掉float属性就不显示?该如何处理

2012-08-30 
span中背景图去掉float属性就不显示?初学css,遇到个奇怪的问题,把float去掉后就看不到背景图,firebug上也

span中背景图去掉float属性就不显示?
初学css,遇到个奇怪的问题,把float去掉后就看不到背景图,firebug上也找不到span元素了,这是什么原因呢?

HTML code
<!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>    <title>文本框中的事件应用</title>    <style type="text/css">            .spnInit{width:179px;height:40px;line-height:40px;float:right;background: url('Images/pic_Email_ok.gif') no-repeat;}    </style></head><body>           <span id="spnTip" class="spnInit"></span></body></html>


[解决办法]
浮动设置以后、你那个span会自动变成块元素的
而你又设置了span的宽跟高、
所以背景图能看到

热点排行