【问题标题】:Img's doesn't show when placed in "div" element [closed]放置在“div”元素中时,Img 不显示 [关闭]
【发布时间】:2013-02-02 07:20:38
【问题描述】:

我已将 img 与 code 放在同一个文件夹中,并在代码“adHere.jpg”中正确拼写了它,所以我知道这不是问题,但它可能是我放入链接的格式。

所以,如果没有到期,让我告诉你。

 <!--Side Bar Code -->
<div class="sidebar">
  <p><a href="">Home Page</a></p>
  <p><a href="">About Me</a></p>
  <p><a href="">Behind the scenes</a></p>
  <p><a href="">Etc.</a></p>
  <img href="adHere.jpg" width="750" height="450"> 
</div>

这是我的代码在 CSS 中的样子:

.sidebar img {border:solid 1px;
      position:relative;
      opacity: 1;}

这是它的渲染方式:http://i.imgur.com/PECdT8M.png

【问题讨论】:

    标签: css html hyperlink image


    【解决方案1】:

    img 的源属性是src 而不是href

    【讨论】:

      【解决方案2】:

      图像源的正确属性是src,而不是href。应该是:

      <img src="adHere.jpg" width="750" height="450"> 
      

      【讨论】:

      • 哦!我认为每次有链接时都会使用href;可能不会。大声笑,谢谢。
      【解决方案3】:

      试试这个代码:

       <!--Side Bar Code -->
      <div class="sidebar">
        <p><a href="">Home Page</a></p>
        <p><a href="">About Me</a></p>
        <p><a href="">Behind the scenes</a></p>
        <p><a href="">Etc.</a></p>
        <img src="adHere.jpg" width="750" height="450"> 
      </div>
      

      CSS 可以保持不变。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-11-10
        • 1970-01-01
        • 2011-03-05
        • 2012-12-11
        • 1970-01-01
        • 2012-01-23
        • 2012-10-17
        • 1970-01-01
        相关资源
        最近更新 更多