Css not getting applied

Posted on 2011-10-20
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
    LVL 17

    Accepted Solution

    Hello,why not just:
    <link  type="text/css" rel="stylesheet" media="all" href="CSS/styles.css"/>

    Author Comment

    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
    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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: HTML5 for Beginning Beginners

    Are you looking for an efficient introduction to HTML5? Have you tried other HTML5 courses and found them too complex? Do you need just the basics of HTML5 to use with Wordpress or other content management system? If you said yes to any of these questions, this course is for you.

    This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
    CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
    In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
    The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now