Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML HTML Basics

Linking to an external style sheet

Discussing Html . Code , Software , other

Moderators: macek, egami, gesf

Linking to an external style sheet

Postby gguppies » Wed Nov 23, 2011 10:18 am

Hi guys, I am trying to link to a css file outside of a folder from a php file inside said folder and need some guidance as to how to do this. My code is:
Code: Select all
<link rel="stylesheet" href="design.css" type="text/css" />
. Please help me out... :help:
gguppies
New php-forum User
New php-forum User
 
Posts: 14
Joined: Wed Nov 23, 2011 8:55 am

Re: Linking to an external style sheet

Postby freshnet » Thu Dec 29, 2011 9:38 am

Several options, depending on what you want. You can use . for the current directory, e.g. ./default.css, .. is the parent directory e.g. ../default.css. If you want to specify the complete path you can do that too using
Code: Select all
$_SERVER['DOCUMENT_ROOT']/completepath/default.css
. You can also specify a complete url e.g.
Code: Select all
http://www.php-forum.com/css/default.css
. If your page may move, a specified url or complete path is better. If not, a relative path (such as ../) is going to be quicker and simpler.
User avatar
freshnet
php-forum Active User
php-forum Active User
 
Posts: 252
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: Linking to an external style sheet

Postby gguppies » Thu Dec 29, 2011 10:02 am

Thanks freshnet,
That works great.
gguppies
New php-forum User
New php-forum User
 
Posts: 14
Joined: Wed Nov 23, 2011 8:55 am


Return to HTML Basics

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.