Setting StyleSheet link from a MasterPage

G

Guest

I want to insert a CSS Stylesheet file in a <LINK> tag inside my MasterPage
so that it will work in all of the the ASPX pages that use that MasterPage
(no matter where the page is in the directory hierarchy).

I tried adding
<link type="text/css" rel="stylesheet"
href="~/Shared/CSS/Standard.css" runat="server" />

in the <head> section of the MasterPage. When I look at the source of my
pages later when I'm running it, it *does* seem to resolve to the right path,
but my styles are not applied.

I know no way of debugging the linking of these things so I don't really
know why it's not finding my stylesheet.css file. Also, I've testing the CSS
file with plain HTML and it works fine.

Any ideas?

Alex
 
G

Guest

I want to insert a CSS Stylesheet file in a <LINK> tag inside my MasterPage
so that it will work in all of the the ASPX pages that use that MasterPage
(no matter where the page is in the directory hierarchy).

I tried adding
<link type="text/css" rel="stylesheet"
href="~/Shared/CSS/Standard.css" runat="server" />

in the <head> section of the MasterPage. When I look at the source of my
pages later when I'm running it, it *does* seem to resolve to the right path,
but my styles are not applied.

I know no way of debugging the linking of these things so I don't really
know why it's not finding my stylesheet.css file. Also, I've testing the CSS
file with plain HTML and it works fine.

Any ideas?

Alex

get rid of (~)
 
G

Guest

I can't get rid of the "~". If I do, it will resolve to the doroot, not the
application root. And while that works in the live environment, it does not
work in run-time in Visual Studio - and I need that.
 
G

Guest

I can't get rid of the "~". If I do, it will resolve to the doroot, not the
application root. And while that works in the live environment, it does not
work in run-time in Visual Studio - and I need that.

Apologies! I see it now...

Regarding your last post, do you mean that in the live environment you
do get the CSS working properly?
 
G

Guest

Okay, guess what - strangest thing just happened: I quit Visual Studio and
then started it again and now it all works perfectly. What on earth is *that*
all about??

Anyway, I guess it's resolved.

Thanks.

Alex
 
G

Guest

Okay, guess what - strangest thing just happened: I quit Visual Studio and
then started it again and now it all works perfectly. What on earth is *that*
all about??

Anyway, I guess it's resolved.

it might happen sometimes with the editor, close the file and open it
again
 
G

Ganesh

Hi alexey

try this working fine for me
\

place it in master page

<link rel="stylesheet" href="../../Common/CSS/main.css"
media="screen,projection"
type="text/css" />


ganesh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top