2017-06-17 43 views
1

HTML在Netbeans的圖像瀏覽器

*{ 
 
    margin: 0px; 
 
    padding: 0px; 
 
} 
 
.container{ 
 
    background-color:#999999; 
 
    width:100%; 
 
    margin-top: 10px; 
 
} 
 
.wrapper{ 
 
    margin-top: 50px; 
 
    width:900px; 
 
    margin:auto; 
 
} 
 
.dark{ 
 
    background-color: #FF4500; 
 
    height: 40px; 
 
    margin-top: 40px; 
 
} 
 
#top_div{ 
 
    line-height: 40px; 
 
} 
 
#div2{ 
 
    height: 220px; 
 
}

上面提到的沒有顯示是我的CSS文件

<html xmlns="https://www.w3.org/1999/xhtml"> 
 
    <head> 
 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
 
     <title>My static web Page</title> 
 
     <link type="text/css" rel="stylesheet" href="css1.css"/> 
 
    </head> 
 
    <body> 
 
     
 
     <div class="container"> 
 
      <div class="wrapper"> 
 
       <div> 
 
        <img src="img.png" width="400" height="400" ></img> 
 
       </div> 
 
      </div> 
 
     </div> 
 
     
 
     <div class="dark"> 
 
      <div class="wrapper" id="top_div"> 
 
       <h2>The Origin</h2> 
 
      </div> 
 
     </div> 
 
     
 
     <div class="container"> 
 
      <div class="wrapper" id="top_div"> 
 
This is my styled paragraph 
 
      </div> 
 
     </div> 
 
     
 
    </body> 
 
</html>

它只顯示圖像圖標,並沒有看到圖像的瀏覽器。 我已將該圖像粘貼到項目目錄中的文件夾中。請添加圖片的正確方法是什麼,請解釋一下。

回答

0

要確保你有正確的路徑(例如:相對./your_file.png

<div> 
    <img src="./img.png" width="400" height="400" ></img>> 
</div> 
0
<div> 
<img src="./foldername/imagename.png" width="400" height="400" /> 
</div> 
+0

仍然不能工作:( –

0

下面的代碼行表示,你的圖像文件img.png駐留在同一文件夾中,你一直html文件。

<img src="img.png" width="400" height="400" ></img> 

如果它被保存在其他文件夾中,然後,你可以提供相關的路徑類似

src="../foldername/img.png" 
0

我試圖從%temp%命令清除臨時文件,它工作!

0

如果你有你的HTML文件和圖像兩種不同的文件夾,然後更新您的img標籤如下:

<img src="../images/img.png" width="400" height="400" ></img>

其中「圖像」是你的圖片放在這個文件夾的名稱。