2011-02-12 66 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