473,506 Members | 17,000 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Style Sheet not getting applied to content page

I have a master page and a content page but the stylesheet isnt getting
applied like how it looks in visual studio design view.

The master page is defined like this:

<%@ Master Language="VB" CodeFile="MasterPage.master.vb"
Inherits="MasterPage" %>

<!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 id="Head1" runat="server">
<title>Overbored.com</title>
<link rel="stylesheet" type="text/css" href="StyleSheet.css" />
</head>
<body>
<div id="wrapper">
<form id="Form1" runat="server">
<div id="header">
<span class="title">Overbored.com</span>
<span class="breadcrumb">Todo: Breadcrumb will go
here...</span>
</div>
<div id="content">
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id="navigation">
<span class="title">Overbored.com</span>
<div id="Div1">
<asp:Menu ID="menu1" DataSourceID="SiteMapDataSource1"
runat="server"></asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1"
ShowStartingNode="false" runat="server" />
</div>
</div>
</form>
</div>
<div id="footer">
<a href="http://www.overbored.com/Portal">http://www.overbored.com</a>
</div>
</body>
</html>

The content page is defines like this:

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master"
AutoEventWireup="false" CodeFile="Login.aspx.vb" Inherits="Login" %>

<asp:Content ID="LoginContent" ContentPlaceHolderID="MainContent"
Runat="Server">

<div>
<asp:Login ID="Login1" runat="server" BackColor="#EFF3FB"
BorderColor="#B5C7DE" BorderPadding="4"
BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana"
Font-Size="0.8em"
ForeColor="#333333">
<TitleTextStyle BackColor="#507CD1" Font-Bold="True"
Font-Size="0.9em" ForeColor="White" />
<InstructionTextStyle Font-Italic="True" ForeColor="Black" />
<TextBoxStyle Font-Size="0.8em" />
<LoginButtonStyle BackColor="White" BorderColor="#507CD1"
BorderStyle="Solid" BorderWidth="1px"
Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284E98" />
</asp:Login>
</div>
</asp:Content>

The style sheet is in the root folder and is called StyleSheet.css

/*
The below CSS file was built using samples + techniques described by
Rachel Andrew in her book:
The CSS Anthology: 101 Essential Tips, Tricks & Hacks
*/

/* Overall Page */

body {
margin: 0;
padding-bottom: 2em;
background-color: #FFFFFF;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
border-top: 2px solid #3366CC;
}

/* Header Section */

#header {
border-top: 3px solid #3366CC;
border-bottom: 1px dotted #3366CC;
height: 3em;
}
#header .title {
font: 190% Arial, Helvetica, Georgia, "Times New Roman", Times, serif;
color: black;
background-color: transparent;
float: left;
margin-right: 2em;
margin-top: 0.3em;
margin-left: .8em;
}
#header .breadcrumb {
font: 90% Arial, Helvetica, Georgia, "Times New Roman", Times, serif;
color: #FFFFFF;
background-color: transparent;
float: right;
margin-right: 2em;
margin-top: 0.8em;
font-weight:bold;
}

#header a:link, a:visited {
color: #B51032;
}

/* Footer */

#footer {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 1.5em;
background-color: #3366CC;
color: #3366CC;
border-top: #778899;
text-align: center;
}

#footer a:link, #footer a:visited {
padding: 0.8em 1em 0.5em 1em;
color: #FFFFFF;
background-color: transparent;
font-size: 80%;
}
/* Navigation */

#navigation {
width: 200px;
top: 5em;
left: 1em;
width: 13em;
position:absolute;
font-family: Arial, Helvetica, sans-serif;
font-size:90%;
}
#navigation ul {
list-style: none;
margin: 0;
padding: 0;
}
#navigation li {
border-bottom: 1px solid #ED9F9F;
}
#navigation li a:link, #navigation li a:visited {
display: block;
padding: 5px 5px 5px 0.5em;
border-left: 12px solid #711515;
border-right: 1px solid #711515;
background-color: #B51032;
color: #FFFFFF;
text-decoration: none;
}
#navigation li a:hover {
background-color: #711515;
color: #FFFFFF;
}
#navigation ul ul {
margin-left: 12px;
}
#navigation ul ul li {
border-bottom: 1px solid #711515;
margin:0;
}
#navigation ul ul a:link, #navigation ul ul a:visited {
background-color: #ED9F9F;
color: #711515;
}
#navigation ul ul a:hover {
background-color: #711515;
color: #FFFFFF;
}

/* Main Content */

#content
{
margin-top:1em;
margin-left: 16em;
margin-right: 2em;
}
h1 {
font: 150% Arial, Helvetica, Georgia, "Times New Roman", Times, serif;
}
#content p {
font-size: 80%;
line-height: 1.6em;
}
In visual studio designer the content page looks right but when i run the
application the master page style is not applied. The content of the master
page is applied but not the style.

Please help!
Dec 10 '06 #1
8 13497
Also, I took the source of my page and put in a blank txt file and saved as
an html file. in that page the style is getting applied correctly. Is it
somethign to do with the permissions of the css file?
Dec 10 '06 #2
Ok, I looked at the output when rendered in IE and it works but does not work
in Firefox. Any ideas how to fix this?

"Amit" wrote:
Also, I took the source of my page and put in a blank txt file and saved as
an html file. in that page the style is getting applied correctly. Is it
somethign to do with the permissions of the css file?
Dec 10 '06 #3
The path to the stylesheet is hard-coded into your masterpage.

Get the "Live HTTP Headers" extension for Firefox and watch what requests it
makes to the server as it retrieves your ASPX pages, I'll bet you'll spot it
ask for the "StyleSheet.css" resource *from the same directory as the
document referencing it*. If the stylesheet is in the root of your website's
(i.e. right after the hostname) prepend "/" so it becomes "/stylesheet.css".

"Amit" <Am**@discussions.microsoft.comwrote in message
news:C8**********************************@microsof t.com...
Ok, I looked at the output when rendered in IE and it works but does not
work
in Firefox. Any ideas how to fix this?

"Amit" wrote:
>Also, I took the source of my page and put in a blank txt file and saved
as
an html file. in that page the style is getting applied correctly. Is
it
somethign to do with the permissions of the css file?

Dec 10 '06 #4
"Amit" <Am**@discussions.microsoft.comwrote in message
news:50**********************************@microsof t.com...
<link rel="stylesheet" type="text/css" href="StyleSheet.css" />
Does your website have no folders, then...? Is everything in the root...?
Dec 10 '06 #5
i have 2 folders set up. The stylesheet is at the root of the site. I tried
prepending a "/" so it becomes /stylesheet.css but that did not work.

Amit

"Mark Rae" wrote:
"Amit" <Am**@discussions.microsoft.comwrote in message
news:50**********************************@microsof t.com...
<link rel="stylesheet" type="text/css" href="StyleSheet.css" />

Does your website have no folders, then...? Is everything in the root...?
Dec 10 '06 #6
"Amit" <Am**@discussions.microsoft.comwrote in message
news:31**********************************@microsof t.com...
>i have 2 folders set up. The stylesheet is at the root of the site. I
tried
prepending a "/" so it becomes /stylesheet.css but that did not work.
That's hardly surprising...

Try this:

<link rel="stylesheet" type="text/css" href="~/StyleSheet.css" />
Dec 10 '06 #7
That did not work.

My masterpage now looks like this
<%@ Master Language="VB" CodeFile="MasterPage.master.vb"
Inherits="MasterPage" %>

<!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 id="Head1" runat="server">
<title>Overbored.com</title>
<link rel="stylesheet" type="text/css" href="~/Styles.css" />
</head>

I installed Live HTTP headers and this is my output.
http://localhost/Overbored/Softball/...ayerStats.aspx

GET
/Overbored/Softball/Login.aspx?ReturnUrl=%2fOverbored%2fSoftball%2fPla yerStats.aspx HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8)
Gecko/20061025 Firefox/1.5.0.8
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie:
..ASPXANONYMOUS=LkfYgoBPxwEkAAAAZjllZTE5MzgtNjE3NS 00YjcwLWI4OTMtYmZkNzdlOTVmZTRm0; ASP.NET_SessionId=oxousfnyrulg31f0yjyrjj2y
Cache-Control: max-age=0

HTTP/1.x 200 OK
Server: Microsoft-IIS/5.1
Date: Sun, 10 Dec 2006 23:31:29 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 8099
----------------------------------------------------------
http://localhost/Overbored/Softball/Styles.css

GET /Overbored/Softball/Styles.css HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8)
Gecko/20061025 Firefox/1.5.0.8
Accept: text/css,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer:
http://localhost/Overbored/Softball/...ayerStats.aspx
Cookie:
..ASPXANONYMOUS=LkfYgoBPxwEkAAAAZjllZTE5MzgtNjE3NS 00YjcwLWI4OTMtYmZkNzdlOTVmZTRm0; ASP.NET_SessionId=oxousfnyrulg31f0yjyrjj2y
Cache-Control: max-age=0

HTTP/1.x 401 Access Denied
Server: Microsoft-IIS/5.1
Date: Sun, 10 Dec 2006 23:31:29 GMT
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
Connection: close
Content-Length: 4046
Content-Type: text/html

"Mark Rae" wrote:
"Amit" <Am**@discussions.microsoft.comwrote in message
news:31**********************************@microsof t.com...
i have 2 folders set up. The stylesheet is at the root of the site. I
tried
prepending a "/" so it becomes /stylesheet.css but that did not work.

That's hardly surprising...

Try this:

<link rel="stylesheet" type="text/css" href="~/StyleSheet.css" />
Dec 10 '06 #8
Ok, thanks guys I think I got it working now. I think it was a combination
of a permission error and a path error for the stylesheet. Thanks for the
tip on the Live HTTP headers...that enabled me to catch the permission error
and thanks for the stylesheet path tip. Looks likes it working.

Amit
Dec 10 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3660
by: Mark Cunningham | last post by:
I am curious if there is something that would be considered a proper method for locating small (three to four items) amounts of page specific styling. Or does it really matter in the great scheme...
1
2251
by: blue | last post by:
My app draws a bunch of tables on the page and has a form for the user to enter data and submit. The form is contained within a User Control called DecisionCtl. When they submit the form, a bunch...
2
3650
by: Kenneth P | last post by:
Hi, I'm developing asp.net (vb) apps in VS.NET 2003, and I'd like to know how you can write style sheet code in a sub in an .aspx page that when it's rendered as html/text/css code in the .aspx...
2
2801
by: ad | last post by:
I use vs2005 to develop web application. I have used the new feature of master page of VS2005, and I have put some <stylein the master page. But I want to override some Style sheet in the content...
8
6662
by: JT | last post by:
Hi, I have done a fair amount of style editing inline in ASP. I'm now using VS 2005 with a standard web project (not Web Application Project). This is my first foray into CSS in a style sheet...
1
1844
by: abaybas | last post by:
I'm creating a page in which a certain "content" part of the page is refreshed using ajax. I do this by using a div#content, and it's child div#container. the code: ... ...
3
2930
by: =?Utf-8?B?U3ViYQ==?= | last post by:
I am using a asp page to dynamically create a stylesheet my asp page creates the following css element when i call the asp page my typing the url in the browser. My asp page works...
5
3708
by: Nathan Sokalski | last post by:
I have css that would normally be placed in style tags in the header of the Master page that I want to add programmatically for a specific Web Content Form (the *.aspx page). How do I do this for a...
4
5626
Frinavale
by: Frinavale | last post by:
So a while ago I created a Tab Strip Control (before the AjaxToolkit had theirs otherwise I would have probably just used theirs). When I looked at the AjaxToolkit control to see how they got...
0
7218
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7103
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7370
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7021
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7478
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5035
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.