Monday, March 26, 2012

Newbie cant get CSS working

Hi,

I'm learning to apply CSS on web site. I've put a link ref of the style sheets in the MasterPage.master. (Of course, the css files have been placed at the correct folder).

Inside VS2005, the look is ok; the CSS style applies correctly. But when I preview (or even after publish web site), the styles don't look like working. The colors simply the applied to the text.

I thought inheritance thru the MasterPage.master gave the problem. Then, I just create another webform page without inheriting master page. Putting the css links and the preview result still not ok. Though with VS2005 everything looks alright.

What i've missed? Thanks!

Jack LING

Head section of the MasterPage.master page:

<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=big5" />
<title>Live</title>
<link href="http://links.10026.com/?link=App_LocalResources/templates/template_css.css" rel="stylesheet" type="text/css" />
<link href="http://links.10026.com/?link=App_LocalResources/templates/theme.css" rel="stylesheet" type="text/css" />
</head>

Hi Jack,

Just a guess here, but I don't think the style sheet should be in the App_LocalResources folder - that strikes me as a special folder that may have varying contents depending where you publish the website. I could be wrong...

Could you run a little experiment? Try puting the stylesheets in the root of your web project and link to them appropriately:

<link href="http://links.10026.com/?link=template_css.css" rel="stylesheet" type="text/css" />

<link href="http://links.10026.com/?link=theme.css" rel="stylesheet" type="text/css" />

See if that corrects the problem. If so then consider moving the /templates folder out of the App_LocalResources folder and just have it sitting directly off the root.

Hope this helps!


Hi Draggor,


Great! Your reminder is correct! So, I won't put things to App_... folders until I learn more about its correct usage.

Thanks much!

Jack LING


is ther any reason you are placing the css file in side the APP_LocalResources folder? I don't think that folder accepts .css type of files and any access to that folder is denied i think.

You have to place the .css file somewhere else.

0 comments:

Post a Comment