Reputation: 119
When I am linking to any file I have to specify the absolute path looking like this
<link rel="stylesheet" type="text/css"
href="F:/XmppOld/XAMPP2/htdocs/MAIN_SITE_LAYOUT/css/stylemainpage.css" />
I would like to narrow it down to
<link rel="stylesheet" type="text/css" href="/css/stylemainpage.css" />
I'm not sure how to. I tried placing stylemainpage.css
inside the page being viewed, but it didn't work.
Upvotes: 0
Views: 126
Reputation: 5153
Keep the CSS file and the HTML pgae in the same folder, then just include the CSS filename. If you want to keep the CSS file in some other folder under the same server root and still want to use relative path names, use ..
and /
. Use ..
to move up a level, and /
to move down a level.
Upvotes: 0
Reputation: 12190
The path depends on where you have placed your HTML files
HTML
index.html
CSS
style.css
CSS path in your HTML file would be - <link href="../CSS/style.css" rel="stylesheet"/>
Edit: in your case the path should be -
<link href="../css/stylemainpage.css" rel="stylesheet" type="text/css" />
Upvotes: 1
Reputation: 51634
Try using <link rel="stylesheet" type="text/css" href="css/stylemainpage.css"/>
(without the leading slash before css
)
Upvotes: 1
Reputation: 9542
<link rel="stylesheet" type="text/css" href="css/stylemainpage.css"/>
put your css
into css folder
Upvotes: 0