开发者

The Image is not getting displayed at the background of column in table in master page?

开发者 https://www.devze.com 2023-02-09 22:36 出处:网络
<%@ Master Language=\"C#\" AutoEventWireup=\"true\" CodeFile=\"MasterPage.master.cs\" Inherits=\"MasterPage\" %>
   <%@ 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>


Try like this:

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

and make sure that the /Images/Bluehills.jpg image actually exists (I see that in your <img> tag you are using a different image name, one with a space in its name and located in the Image folder instead of Images).

Also make sure that you define some height and width of the <td> or the image might not display:

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

I would also strongly recommend you using FireBug to inspect what images are loaded and for those that are not loaded see the reason. It is an excellent tool and a must-have for every web developer.


Found a strange but got the image to display

Here is solution i used it without tilde sign and it work don't know why please if u know help me to understand

Small line Code is

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

</td>

By using this image get displayed

0

精彩评论

暂无评论...
验证码 换一张
取 消