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.
Add master page, then link css script and paste the link of CSS using drag and drop method
it is getting confuse, because of your
src
, it finding it incurrent_folder+src
, but your image folder is in root folder, for that to reachroot_folder+src
you have to prefix your source with~/
This largely depends on where your css file is located. If it is located in the same folder where the 'image' folder is located, then this looks correct. However, if you css file is in a different directory (say /css) then your link in your css file will not work. Instead, either change the css link to point to a complete link:
I am unsure if the '~' link will work in a stylesheet. Since your css is in the scripts folder, you should be able to do this:
This worked for me :