Reputation: 1543
I have a Masterpage and I want to bind a part of this master page to a *.css file but no success.this is my Masterpage code:
<head runat="server" >
<title></title>
<link href="~/Styles/Test.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="HeadContent" runat="server" >
</asp:ContentPlaceHolder>
</head>
<body>
<form runat=server>
<body>
<table width=100% border=1>
<tr width=100%>
<td ></td>
<div class=mainbody>
<td width=80% align=center>
<asp:ContentPlaceHolder ID="MainContent" runat="server"></asp:ContentPlaceHolder>
</td>
</div>
<td ></td>
</tr>
</table>
</body>
</form>
</body>
and in my css file I have:
body
{
}
mainbody
{
background-color:#a0ccff
}
coild you please tell me,why it doesn't work?
Upvotes: 0
Views: 448
Reputation: 8184
Look, you can't put a td inside a DIV element... Change your code from
... <head runat="server" >
<title></title>
<link href="~/Styles/Test.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="HeadContent" runat="server" >
</asp:ContentPlaceHolder>
</head>
<body>
<form runat=server>
<body>
<table width=100% border=1>
<tr width=100%>
<td ></td>
<div class=mainbody>
<td width=80% align=center>
<asp:ContentPlaceHolder ID="MainContent" runat="server"></asp:ContentPlaceHolder>
</td>
</div>
<td ></td>
</tr>
</table>
</body>
</form>
</body>
...
to
<head runat="server" > <title></title>
<link href="~/Styles/Test.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="HeadContent" runat="server" >
</asp:ContentPlaceHolder>
</head>
<body>
<form runat=server>
<table width=100% border=1>
<tr width=100%>
<td ></td>
<td width=80% align=center>
<div class=mainbody>
<asp:ContentPlaceHolder ID="MainContent" runat="server"> </asp:ContentPlaceHolder>
</div>
</td>
<td ></td>
</tr>
</table>
</form> </body>
It will then work as you wish (I advice you to copy my code and Paste it in your SIte.Master file)
Upvotes: 1
Reputation: 450
Try:
<link href="/Styles/Test.css" ...>
instead of :
<link href="~/Styles/Test.css" ...>
Upvotes: 0
Reputation: 39501
class selectors should start with dot
.mainbody
{
background-color:#a0ccff
}
Upvotes: 7