2016-12-31 83 views
0

我是一个全新的编码,并且无法确定为什么两个看似相同的代码工作不一样。这个练习只涉及在网页上显示图片。很简单,但我不明白为什么相同的代码只能用于两次。图片不会出现

此代码:

 <div class="col-sm-6"> 
     <div class="well text-center"> 
      <div> 
       img class="img-responsive" src="http://pre10.deviantart.net/1d23/th/pre/i/2013/070/1/e/grumpy_cat_by_bwcopy-d5xod2v.jpg" 
      </div> 

尽管此代码不:

 <div class="col-sm-6"> 
     <div class="well text-center"> 
      <div> 
       img class="img-responsive" src="https://img.buzzfeed.com/buzzfeed-static/static/2015-04/21/16/enhanced/webdr05/enhanced-31550-1429646952-7.jpg" 
      </div> 

我检查了源非工作的照片,这是有效的。 (如果你喜欢超可爱的小狗,请自己检查一下)。

我没有看到什么? (显然除了小狗图片)。

谢谢。

+0

认为你缺少的开闭img'的'括号:' ' – linusg

回答

1

您没有使用img标记,您只是在写纯文本。

改变这种(注意括号):

<img class="img-responsive" src="http://pre10.deviantart.net/1d23/th/pre/i/2013/070/1/e/grumpy_cat_by_bwcopy-d5xod2v.jpg" /> 

第一和第二代码片段看起来是一样的,没有任何理由任何一方的应该工作。

+0

谢谢Omri。也许我应该提到这是一个调试练习。对两个早期相同网站的工作代码和非工作代码进行比较和修正。我修复了其他部分,但这一个。 –

0

试试这个

 \t \t <div class="col-sm-6"> 
 
\t \t \t <div class="well text-center"> 
 
\t \t \t \t <div> 
 
\t \t \t \t \t <img class="img-responsive" src="http://pre10.deviantart.net/1d23/th/pre/i/2013/070/1/e/grumpy_cat_by_bwcopy-d5xod2v.jpg"> 
 
\t \t \t \t </div>

或本:

<div class="col-sm-6"> 
 
\t \t \t <div class="well text-center"> 
 
\t \t \t \t <div> 
 
\t \t \t \t \t <img class="img-responsive" src="https://img.buzzfeed.com/buzzfeed-static/static/2015-04/21/16/enhanced/webdr05/enhanced-31550-1429646952-7.jpg"> 
 
\t \t \t \t </div> \t

+0

谢谢Abood。添加尖括号到非工作(狗)代码工作。我的问题是为什么,因为它们不在工作(猫)代码中。位于https url上的狗图像是否需要尖括号,而猫图像的url是否不是http?谢谢你的帮助。 –

+0

它猫和狗的图像都不显示,直到你添加天使托架! – Abood