By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,275 Members | 1,009 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,275 IT Pros & Developers. It's quick & easy.

CSS in MasterPages

P: n/a
I have a master page I want to use a CSS stylesheet for. I put the link tag
in the master page markup, like this <link href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any ideas? This
is kind of baffling.

Dec 3 '07 #1
Share this Question
Share on Google+
15 Replies


P: n/a
Is the content page in a different folder than the master page? Try an
absolute path in your css link. Or better yet, use Themes.

"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:D1**********************************@microsof t.com...
>I have a master page I want to use a CSS stylesheet for. I put the link tag
in the master page markup, like this <link href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any ideas?
This
is kind of baffling.
Dec 3 '07 #2

P: n/a
Both are in the same folder. I've tried to use themes. That doesn't work
either.

"Scott Roberts" wrote:
Is the content page in a different folder than the master page? Try an
absolute path in your css link. Or better yet, use Themes.

"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:D1**********************************@microsof t.com...
I have a master page I want to use a CSS stylesheet for. I put the link tag
in the master page markup, like this <link href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any ideas?
This
is kind of baffling.

Dec 3 '07 #3

P: n/a
What is frustrating is that if I use themes and look at the source of the
page I can see that the Styleheet is being inked in as it is supposed to be.
It just isn't doing anything.

"Scott Roberts" wrote:
Is the content page in a different folder than the master page? Try an
absolute path in your css link. Or better yet, use Themes.

"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:D1**********************************@microsof t.com...
I have a master page I want to use a CSS stylesheet for. I put the link tag
in the master page markup, like this <link href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any ideas?
This
is kind of baffling.

Dec 3 '07 #4

P: n/a
Do you have security on the folders holding the CSS and/or Theme files?
"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:15**********************************@microsof t.com...
What is frustrating is that if I use themes and look at the source of the
page I can see that the Styleheet is being inked in as it is supposed to
be.
It just isn't doing anything.

"Scott Roberts" wrote:
>Is the content page in a different folder than the master page? Try an
absolute path in your css link. Or better yet, use Themes.

"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:D1**********************************@microso ft.com...
>I have a master page I want to use a CSS stylesheet for. I put the link
tag
in the master page markup, like this <link
href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content
page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any ideas?
This
is kind of baffling.

Dec 3 '07 #5

P: n/a
On Dec 3, 11:15 pm, Rbrt <R...@discussions.microsoft.comwrote:
I have a master page I want to use a CSS stylesheet for. I put the link tag
in the master page markup, like this <link href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any ideas? This
is kind of baffling.
Improve you markup.
<link rel="Stylesheet" href="~/Styles/MyStyle.css" runat="server" />
Dec 4 '07 #6

P: n/a
I have tried every variation of the link markup I can think of. As I said,
the css works in design view. It is just at runtime that it disappears.

"SMiGL" wrote:
On Dec 3, 11:15 pm, Rbrt <R...@discussions.microsoft.comwrote:
I have a master page I want to use a CSS stylesheet for. I put the link tag
in the master page markup, like this <link href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any ideas? This
is kind of baffling.

Improve you markup.
<link rel="Stylesheet" href="~/Styles/MyStyle.css" runat="server" />
Dec 4 '07 #7

P: n/a
I have forms authentication but the web.config file has a location entry for
the css file that should make it accessible. I've played around with it quite
a bit but no luck.

"Scott Roberts" wrote:
Do you have security on the folders holding the CSS and/or Theme files?
"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:15**********************************@microsof t.com...
What is frustrating is that if I use themes and look at the source of the
page I can see that the Styleheet is being inked in as it is supposed to
be.
It just isn't doing anything.

"Scott Roberts" wrote:
Is the content page in a different folder than the master page? Try an
absolute path in your css link. Or better yet, use Themes.

"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:D1**********************************@microsof t.com...
I have a master page I want to use a CSS stylesheet for. I put the link
tag
in the master page markup, like this <link
href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content
page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any ideas?
This
is kind of baffling.



Dec 4 '07 #8

P: n/a
Well it appears that I can get skins to work but CSS simply will not work no
matter what I do. I am giving up on CSS and instead of defining things like
tables in html, I am using asp, which is a ridiculous increase in server load
but what else can I do? I want to use CSS to save time, but have already
wasted an entire bloody day on this and have to get on with the job.

Very, very frustrating. It is hard to imagine something more basic to web
development than CSS and to have this sort of problem is just not acceptable.

"Rbrt" wrote:
I have a master page I want to use a CSS stylesheet for. I put the link tag
in the master page markup, like this <link href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any ideas? This
is kind of baffling.
Dec 4 '07 #9

P: n/a
What exactly do you mean, regarding themes, that they 'don't work'

When the Master page includes the exact correct theme, I have had no
problems using themes with CSS files.
Of course, I assign my theme in the Web.config file

David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup
"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:DF**********************************@microsof t.com...
Both are in the same folder. I've tried to use themes. That doesn't work
either.

"Scott Roberts" wrote:
>Is the content page in a different folder than the master page? Try an
absolute path in your css link. Or better yet, use Themes.

"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:D1**********************************@microso ft.com...
>I have a master page I want to use a CSS stylesheet for. I put the link
tag
in the master page markup, like this <link
href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content
page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any ideas?
This
is kind of baffling.


Dec 4 '07 #10

P: n/a
To verify that your location entry is working, try typing the url to the CSS
file directly into your browser address bar. Do you get an error?
"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:7E**********************************@microsof t.com...
>I have forms authentication but the web.config file has a location entry
for
the css file that should make it accessible. I've played around with it
quite
a bit but no luck.

"Scott Roberts" wrote:
>Do you have security on the folders holding the CSS and/or Theme files?
"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:15**********************************@microso ft.com...
What is frustrating is that if I use themes and look at the source of
the
page I can see that the Styleheet is being inked in as it is supposed
to
be.
It just isn't doing anything.

"Scott Roberts" wrote:

Is the content page in a different folder than the master page? Try an
absolute path in your css link. Or better yet, use Themes.

"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:D1**********************************@microso ft.com...
I have a master page I want to use a CSS stylesheet for. I put the
link
tag
in the master page markup, like this <link
href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content
page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any
ideas?
This
is kind of baffling.

Dec 4 '07 #11

P: n/a
No. It directs me to the logon page. Once I have logged in, I can type the
url of the css into the browser address bar and it asks me if I want to save
it to my hard drive. As I said, it displays the css markup in design view,
but not at runtime.

On the other hand, skins do not show up at design time but do show up at run
time.

Pretty weird.

"Scott Roberts" wrote:
To verify that your location entry is working, try typing the url to the CSS
file directly into your browser address bar. Do you get an error?
"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:7E**********************************@microsof t.com...
I have forms authentication but the web.config file has a location entry
for
the css file that should make it accessible. I've played around with it
quite
a bit but no luck.

"Scott Roberts" wrote:
Do you have security on the folders holding the CSS and/or Theme files?
"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:15**********************************@microsof t.com...
What is frustrating is that if I use themes and look at the source of
the
page I can see that the Styleheet is being inked in as it is supposed
to
be.
It just isn't doing anything.

"Scott Roberts" wrote:

Is the content page in a different folder than the master page? Try an
absolute path in your css link. Or better yet, use Themes.

"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:D1**********************************@microsof t.com...
I have a master page I want to use a CSS stylesheet for. I put the
link
tag
in the master page markup, like this <link
href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content
page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any
ideas?
This
is kind of baffling.



Dec 4 '07 #12

P: n/a
Hi,

I have noticed many times that changes in my stylesheets are not immediately
effectuated at runtime...

Internet Explorer has cached a previous version of my stylesheet file then.

I have to manually delete cached files in Internet Explorer: Tools |
Internet Options, tabpage 'general', press 'delete...' in 'Browsing history'
and then press 'delete files...'

After that I press F5 and then my changes are effective.

Hope this helps,

Hans
"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:55**********************************@microsof t.com...
Well it appears that I can get skins to work but CSS simply will not work
no
matter what I do. I am giving up on CSS and instead of defining things
like
tables in html, I am using asp, which is a ridiculous increase in server
load
but what else can I do? I want to use CSS to save time, but have already
wasted an entire bloody day on this and have to get on with the job.

Very, very frustrating. It is hard to imagine something more basic to web
development than CSS and to have this sort of problem is just not
acceptable.

"Rbrt" wrote:
>I have a master page I want to use a CSS stylesheet for. I put the link
tag
in the master page markup, like this <link href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any ideas?
This
is kind of baffling.

Dec 5 '07 #13

P: n/a
Skins do work, but CSS does not. I am declaring the theme in the Content page
and have EnableTheming=true in both Master and Content pages. I did try
declaring it in the web.comfig and it made no difference.

CSS will work at design time only if I put a <link rel....declaration in
the Master Page. At run time, the markup disappears.

"David Wier" wrote:
What exactly do you mean, regarding themes, that they 'don't work'

When the Master page includes the exact correct theme, I have had no
problems using themes with CSS files.
Of course, I assign my theme in the Web.config file

David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup
"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:DF**********************************@microsof t.com...
Both are in the same folder. I've tried to use themes. That doesn't work
either.

"Scott Roberts" wrote:
Is the content page in a different folder than the master page? Try an
absolute path in your css link. Or better yet, use Themes.

"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:D1**********************************@microsof t.com...
I have a master page I want to use a CSS stylesheet for. I put the link
tag
in the master page markup, like this <link
href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content
page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any ideas?
This
is kind of baffling.




Dec 5 '07 #14

P: n/a
Thank you very much for your suggestion. I tried it but it didn't help.

I will keep checking here to see if there are any other suggestions, and I
am grateful for the advice you have all given, but I have to move on with the
project. I am not going to waste any more time on CSS but will put the markup
in the Master pages directly. At least that will provide some level of
reusability and control.

Robert

"Hans Nieuwenhuis" wrote:
Hi,

I have noticed many times that changes in my stylesheets are not immediately
effectuated at runtime...

Internet Explorer has cached a previous version of my stylesheet file then.

I have to manually delete cached files in Internet Explorer: Tools |
Internet Options, tabpage 'general', press 'delete...' in 'Browsing history'
and then press 'delete files...'

After that I press F5 and then my changes are effective.

Hope this helps,

Hans
"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:55**********************************@microsof t.com...
Well it appears that I can get skins to work but CSS simply will not work
no
matter what I do. I am giving up on CSS and instead of defining things
like
tables in html, I am using asp, which is a ridiculous increase in server
load
but what else can I do? I want to use CSS to save time, but have already
wasted an entire bloody day on this and have to get on with the job.

Very, very frustrating. It is hard to imagine something more basic to web
development than CSS and to have this sort of problem is just not
acceptable.

"Rbrt" wrote:
I have a master page I want to use a CSS stylesheet for. I put the link
tag
in the master page markup, like this <link href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any ideas?
This
is kind of baffling.


Dec 5 '07 #15

P: n/a
I can understand your frustration, but rest assured that CSS *does* work.
It's just not working for you. ;)

What I usually do when I have a particularly frustrating problem is try to
create a very simple project that exhibits the problem. You can then share
that simple project with the community and they can help you troubleshoot.
More often than not, I am *unable* to duplicate my problem in a new, simple
project - which means that I've got something whacked in my big, complicated
project. Then it's a matter of finding out "what's different".

Perhaps you could try that. Create a simple web project (no security or
anything) and see if your CSS file works. Assuming it does, keep adding
things to your sample until it breaks. Then share that project with us.

Scott
"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:C9**********************************@microsof t.com...
Skins do work, but CSS does not. I am declaring the theme in the Content
page
and have EnableTheming=true in both Master and Content pages. I did try
declaring it in the web.comfig and it made no difference.

CSS will work at design time only if I put a <link rel....declaration in
the Master Page. At run time, the markup disappears.

"David Wier" wrote:
>What exactly do you mean, regarding themes, that they 'don't work'

When the Master page includes the exact correct theme, I have had no
problems using themes with CSS files.
Of course, I assign my theme in the Web.config file

David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with
no
bloated markup
"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:DF**********************************@microso ft.com...
Both are in the same folder. I've tried to use themes. That doesn't
work
either.

"Scott Roberts" wrote:

Is the content page in a different folder than the master page? Try an
absolute path in your css link. Or better yet, use Themes.

"Rbrt" <Rb**@discussions.microsoft.comwrote in message
news:D1**********************************@microso ft.com...
I have a master page I want to use a CSS stylesheet for. I put the
link
tag
in the master page markup, like this <link
href="Styles/MyStyle.css"
rel="stylesheet" type="text/css" />

It works fine in Visual Studio design view when I look at a content
page
that uses the master page. However, when I run my web site app, the
stylesheet markup mysteriously disappears. Does anybody have any
ideas?
This
is kind of baffling.


Dec 5 '07 #16

This discussion thread is closed

Replies have been disabled for this discussion.