Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET CSS file in master page

In my application I have next problem. I created master page and some content pages, some of which are located in the nested folders. In the master page I added the link to .css file

<link href="default.css" rel="stylesheet" type="text/css" />

But pages are located in the nested folders can't use this .css file. How can I fix this? I want to have one .css file for all pages (:

Thanks!

like image 422
w1z Avatar asked Nov 28 '22 19:11

w1z


2 Answers

<link href="~/default.css" rel="stylesheet" type="text/css" />
like image 121
Tim Mahy Avatar answered Dec 10 '22 06:12

Tim Mahy


This problem can be resolved by adding next code in master page

<style type="text/css" runat="server">
    @import '<%= ResolveUrl("~/default.css")%>';
</style>

But designer of VS can't process this and you couldn't view your styles in it.

like image 29
w1z Avatar answered Dec 10 '22 05:12

w1z