Learn how to a build a cloud-first strategyRegister Now


Css not getting applied

Posted on 2011-10-20
Medium Priority
Last Modified: 2012-05-12
My web app directory structure is like


in my master page i have linked my stylesheet like this

 <link  type="text/css" rel="stylesheet" media="all" href='<%= ResolveUrl("~/CSS/styles.css") %>'/>

it only works when i  remove my master page head elements runat=server attribute. Is there any fix for this problem. If i  keep the runat=server attribute I see this in viewsource for my stylehsheet

<link href="../<%= ResolveUrl("~/CSS/styles.css") %>" media="all" rel="stylesheet" type="text/css">
It does have css tree linked but it won't apply

Any ideas why
Question by:mmalik15
  • 2
LVL 17

Accepted Solution

Carlos Villegas earned 2000 total points
ID: 37001383
Hello,why not just:
<link  type="text/css" rel="stylesheet" media="all" href="CSS/styles.css"/>

Author Comment

ID: 37001406
It does not work. Tried that in the first place. Also i need to change the master page programatically at run time.
LVL 17

Expert Comment

by:Carlos Villegas
ID: 37001448
Your master page head element looks like this?
<head runat="server">
    <link href="CSS/styles.css" rel="stylesheet" type="text/css" />
    <asp:ContentPlaceHolder ID="head" runat="server">

Open in new window


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
Suggested Courses
Course of the Month20 days, 16 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question