Toots
Toots

Reputation: 57

Read a CSS file outside a main folder

I have html file in main(X-folder) which has CSS also, and I convert HTML to asp and i need to put inside a ASP[Y] folder.. My question since my CSS file is in main folder[X] how can i access on to it. suppose i am in X folder

my problem is that my File in Y folder which is converted to .asp file when i access its url i lost majority of its image and styles

how can i re-write my css

i tried few; still its not read the CSS

this is an image which describe my problems enter image description here

<link href="X/css/style.css" rel="stylesheet" type="text/css"  media="all" />
        <link rel="stylesheet" href="X/css/responsiveslides.css">
    <link href="X/css/iframeCSS.css" rel="stylesheet" type="text/css">

Upvotes: 0

Views: 3774

Answers (2)

A Biswas
A Biswas

Reputation: 431

The stylesheets included in your page are using relative paths.

Specify your stylesheet links with

runat=server

and prefix them with the virtual web root path

 (~) 

For example :

<link href="~/X/css/style.css" rel="stylesheet" type="text/css" media="screen" runat="server" />

Upvotes: -1

Drew Lemmy
Drew Lemmy

Reputation: 447

Have you tried using a leading slash (/ at the start)? It indicates to load the resource from the root of the web server. For example, with <link href="/X/css/style.css" ... /> it will load from example.com/X/css/style.css.

You could also use ../, which indicates to load a resource from a directory below (up a level). So if you were in directoy Y/, you could do <link href="../X/css/style.css" ... /> which loads the resource, again, at example.com/X/css/style.css.

Upvotes: 2

Related Questions