2011-06-08 38 views
0

我目前编写的所有前端设计都在Chrome中正确工作。现在我正在浏览和跨浏览器测试和修复错误。我在Safari中遇到了一个奇怪的错误,图片无法正确显示。看看HTML:Safari出现问题<img src> css

<li class="newsfeedlist-item"> 
<div class="questionslogo"</div> 
<div class="newsfeedlist-image"> 
<img src="http://images.ted.com/images/ted/2ade6b48aac1eb21b7b90fe43335a8e70771455c_50x50.jpg"></div> 
<div class="newsfeedlist-content"> 
<h3><b><a href="#">What Is The Best Way To Become A Photographer? </a></b></h3> 
<div class="newsfeedlist-bodytext"> What if a fish came across a river? Then what??? What if a fish came across a river? Then what??? What if a fish came across a river? Then what??? What if a fish came across a river? Then what??? What if a fish came across a river? Then what???</div> 
<div class="newsfeedlist-questionauthor"> <i>Started By <a href="#">Robert Sopel</i></a></div> 
</div> 
</li> 

你会注意到它是一堆简单的div,所有参考脚本都来自CSS。 Safari中的错误(在我看来)不是来自CSS,而是来自html中的“img src”标记。但这里的“newsfeedlist图像”和“questionslogo”的CSS,这两者有错误:

.questionslogo { 
width: 84px; 
background: url(images/questions.png) top left no-repeat; 
padding: 8px 0px 0px 100px; 
float: left; 
} 

.newsfeedlist-image { 
width: 48px; 
float: left; 
} 

注意,我曾尝试固定两个及显示高度:块,但这并不改变事实上,在Safari中,它无法识别图像(不能单击并拖动它,它只是悬停在它上面)请参见下面的屏幕截图。

铬:

http://www.cl.ly/3f1Z143b3X0V1N1i1b1c

火狐:

http://www.cl.ly/471R002N3v182q2W1V1j

终于Safari浏览器:

http://www.cl.ly/1X3H2W1A1V3b0G3V2n0G

我认为这是一个简单的修复,但现在不能碰到它。将不胜感激任何帮助。谢谢!!!

回答

0

问题是这样的部分,那就是你有一个错字:

<div class="questionslogo"</div> 

修复它通过添加>

<div class="questionslogo"></div> 

为自己找到这样的错误,这是验证一个好主意你的HTML使用:http://validator.w3.org/


我也注意到你也有:

<i>Started By <a href="#">Robert Sopel</i></a> 

您已经关闭顺序错误的标签,它应该是:

<i>Started By <a href="#">Robert Sopel</a></i> 
+0

嗯精彩的建议,谢谢 - 愚蠢的错误:d。我将在下次验证。添加“>”之后,整个事情在所有浏览器中都会混乱,但现在这是一个CSS问题,我将要经历这个问题。谢谢! – sthomps 2011-06-08 19:30:53

+0

这是我写的第一个代码,它的相当丑陋。我想我会用浮游物重做它,正确地做。谢谢 – sthomps 2011-06-08 19:35:02

+0

thx,你的观点导致我重做整个部分。它砍掉了大约50行代码,并运行跨浏览器,所以thx! :) – sthomps 2011-06-08 22:18:15