Css not getting applied

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
Who is Participating?
Carlos VillegasFull Stack .NET DeveloperCommented:
Hello,why not just:
<link  type="text/css" rel="stylesheet" media="all" href="CSS/styles.css"/>
mmalik15Author Commented:
It does not work. Tried that in the first place. Also i need to change the master page programatically at run time.
Carlos VillegasFull Stack .NET DeveloperCommented:
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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.