开发者

ASP .NET Razor PNG image not showing up?

I am new to Razor in ASP .NET, and I am trying to show up a simple PNG image.

Here is my template:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Scavenius - @Page.Title</title>
        <link href="@Href("~/Styles/Site.css")" rel="stylesheet" />
        <link href="@Href("~/favicon.ico")" rel="shortcut icon" type="image/x-icon" />
    </head>
    <body>
        <div id="开发者_C百科background">
        </div>
        <div id="page">
            <div id="main">
                <div id="content">
                    <h1>@Page.Title</h1>
                    @RenderBody()
                </div>
                <div id="footer">
                    &copy; @DateTime.Now.Year - Flamefusion Entertainment
                </div>
            </div>
        </div>
    </body>
</html>

And here is my CSS:

body div#background 
{
    background-image:url(/Images/Background.png);
    background-repeat:no-repeat;
    width:100%;
    height:100%;
    top:0px;
    left:0px;
    position:absolute;
}

I have added the "Background.png" item into the Images folder by dragging it on there, but still, I don't see the image. How come?


try

background-image:url('../Images/Background.png');

assuming that Images is in the root project folder.

Also you could use firebug to see the path trying to be loaded and if it is correct.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜