Reputation: 4928
guys i have a css file "menu.css" i called it in the head of my master page but it does not seem to work.
<link href="CSS/menu.css" rel="stylesheet" type="text/css" />
i tried many alternatives such as
<link id="Link1" href='<%= ResolveUrl("~/CSS/menu.css") %>' rel="stylesheet" media="screen" type="text/css"/>
But all to no avail. However when i paste the content of the css in the master page head there by eliminating the css file, it then works. I really don't understand what the error is. All seem ok but it is not doing as expecteed. Below is my Master page. Any help would be appreciated.
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Debt.master.cs" Inherits="Debt.Debt" %>
<!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 id="Link2" href='<%= ResolveUrl("~/CSS/menu.css") %>' rel="stylesheet" media="screen" type="text/css"/>
<title>Members Page</title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
* { margin:0;
padding:0;
}
body { background:#555 url(images/back.jpg); }
#menu { top:30px; }
#copyright {
margin:100px auto;
width:80%;
font:12px 'Trebuchet MS';
color:#bbb;
text-indent:20px;
padding:40px 0 0 0;
}
#copyright a { color:#bbb; }
#copyright a:hover { color:#fff; }
.style1
{
}
.ModalBackground
{
background-color:Gray;
filter: alpha(opacity=60);
opacity: 0.6;
z-index: 10000;
}
.ModalPopup
{
background-color:White;
border-width:3px;
border-style:solid;
border-color:Gray;
padding:5px;
width: 350px;
height:210px;
}
</style>
<link id="Link1" href='<%= ResolveUrl("~/CSS/menu.css") %>' rel="stylesheet" media="screen" type="text/css"/>
<link href="CSS/menu.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript" src="scripts/menu.js"></script>
</head>
<body runat="server">
Upvotes: 2
Views: 5362
Reputation: 4928
Thanks guys for all the help. I figured what the error was. It was the images path form the CSS. i called the images as follows
background:url(images/columns.png) no-repeat;
background:url(images/subitem.png) no-repeat;
For some reason, it does not recognizes the above images path. However when i changed to
background:url(/images/columns.png) no-repeat;
background:url(/images/subitem.png) no-repeat;
That is adding a slash before the folder name. It works fine now. Thanks for your time.
Upvotes: 2
Reputation: 3676
If you are using Visual Studio 2012 you can simply drag any CSS or JS file from the solution browser into your HTML document, and the editor creates the link statement for you. I personally prefer this approach as it eliminates the chance of path errors.
Hope that helps!
Upvotes: 0