Setting background image in asp.net (Master page)

Posted by JRC on Stack Overflow See other posts from Stack Overflow or by JRC
Published on 2012-12-02T05:00:33Z Indexed on 2012/12/02 5:03 UTC
Read the original article Hit count: 166

Filed under:
|
|
|

I'm new in asp.net. And I am having trouble setting my background image. Here's the master page source:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Master.master.cs" Inherits="Master"%>

<!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">
    <link rel="stylesheet" type="text/css" href="scripts/style.css"/>
    <title>Tracker</title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div class="container">
                <a href="#"><img src="images/cross-header.gif" alt="Insert Logo Here" width="100%" id="Insert_logo" style="background: #C6D580; display:block;" /></a>

            <div class="sidebar1">
                <nav>
                    <ul>
                        <li><a href="#">Home</a></li>
                        <li><a href="#">LINK</a></li>
                        <li><a href="#">LINK</a></li>
                        <li><a href="#"><span style="font-weight:italic">LINK</span></a></li>
                        <li><a href="#"><span style="font-weight:italic">LINK</span></a></li>
                    </ul>
                </nav>
                    <p>SOME LABEL</p>
                    <p>SOME QUOTE HERE</p>
                    <p></p>
            </div>
        </div>
        <footer>
           <a href="#">LINK HERE</a> | <a href="#">LINK HERE</a> | 
           <a href="contact.php">CONTACT</a> | <a href="register.php">REGISTER</a> | <a href="login.php">LOGIN</a>
            <address>
                Copyright 2012 @JRC
            </address>
        </footer>
    </div>
    </form>
</body>
</html>

The image that I am trying to use is located at the folder image. I don't know whats wrong.

And here's what the style.css source:

body 
{
    font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
    margin: 0;
    padding: 0;

    background-image:url('images/background.jpg');
    background-repeat:no-repeat;
    background-attachment:scroll;
    background-position:repeat-x;
}

I also tried this url('image/background.jpeg') etc. but still fails.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about .NET