2011-02-12 27 views
0
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %> 

<!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 runat="server"> 
    <title>Untitled Page</title> 






    <style type="text/css"> 
     .style1 
     { 
      width: 50px; 
      height: 323px; 
     } 
     .style2 
     { 
      width: 650px; 
      height: 323px; 
     } 
    </style>  

</head> 
<body> 
    <form id="form1" runat="server"> 
    <div> 
    <table> 
    <tr> 
    <td style="width:30px; height:20px;"> 
     <img src="Image/Blue%20hills.jpg" 
      style="height: 83px; width: 734px;" /> 
    </td> 
    </tr> 
    <tr> 
    <td> 
    <table> 
    <tr> 
    <td style="background-color:Black; background-image:url('~/Images/Bluehills.jpg');" class="style1"> 

    </td> 
    <td class="style2"> 
    <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"> 

     </asp:ContentPlaceHolder> 
    </td> 
    </tr> 
    </table> 
    </td> 
    </tr> 
    <tr> 

    <td> 
    reserved &copy; softech infoways 
    </td> 
    </tr> 
    </table> 

    </div> 
    </form> 
</body> 
</html> 
+0

我添加背景圖片,但在它的代碼是不是在這個帖子中顯示不知道爲什麼? – Learner 2011-02-12 14:07:34

回答

0

嘗試這樣的:

<td style="background-color:Black; background-image:url('<%= ResolveUrl("~/Images/Bluehills.jpg") %>');" class="style1"> 
</td> 

,並確保該/Images/Bluehills.jpg圖像確實存在(我看到在您的<img>標籤您使用的是不同的形象的名字,一個在其名稱中的空格和位於在Image文件夾中而不是Images)。

另外,還要確保你定義的<td>或圖像的一些高度和寬度可能不會顯示:

<td style="background-color:Black; width: 100px; height: 100px; background:url('<%= ResolveUrl("~/Images/Bluehills.jpg") %>') no-repeat;" class="style1"> 
</td> 

我也強烈建議您使用FireBug檢查裝載什麼樣的圖像和那些沒有加載看到原因。它是一款出色的工具,也是每個Web開發人員必備的工具。

+0

@jagdeep,FireBug對此有何評論?什麼原因? – 2011-02-12 14:18:47

0

發現一個奇怪的,但得到了圖像顯示

這裏是解決方案,我用它沒有波浪符號和它的工作不知道爲什麼請,如果你知道幫我瞭解

小行代碼是

<td style="background-image:url(Image/Bluehills.jpg);" class="style1"> 
oiyhoyhobhobjho 
jgkifjklhjljh 
hghdoyjofjohjypt 
dhgijrlyjhoftjpohktpu 

</td> 

通過使用這種圖像顯示GET