Best way to include CSS files
Moderator: General Moderators
- RandomEngy
- Forum Contributor
- Posts: 173
- Joined: Wed Jun 26, 2002 3:24 pm
- Contact:
Best way to include CSS files
I was wondering what the best way to include a CSS file is. You could use the link function for a clientside include or just put the whole declaration in a file, and include it via PHP inside the <head> tags. Which way is better, or does it not matter?
-
daemorhedron
- Forum Commoner
- Posts: 52
- Joined: Tue Jul 23, 2002 11:03 am
I always link my style sheets to make things easier when changing the look of the site.
Just put the following code in your header file.
Just put the following code in your header file.
Code: Select all
<?php
echo "<link rel="stylesheet" href="your_style.css" type="text/css" />";
?>- RandomEngy
- Forum Contributor
- Posts: 173
- Joined: Wed Jun 26, 2002 3:24 pm
- Contact:
- RandomEngy
- Forum Contributor
- Posts: 173
- Joined: Wed Jun 26, 2002 3:24 pm
- Contact:
Errr... hmm... okay, it doesn't seem to be including correctly that way.
Inside head:
include.css (in same folder):
The link colors work fine but none of the body modifiers work when I include the file via <link>.
Inside head:
Code: Select all
<link rel="stylesheet" href="include.css" type="text/css" />Code: Select all
<style type="text/css">
body {font-family: Arial, sans-serif; background-color: #FFFFFF; color: #000000}
A:link {color: #0000FF}
A:visited {color: #000066}
A:active {color: #3366FF}
A:hover {color: #0099FF}
</style>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Try changing:
to
You don't need the style tags because you're already in a document which has been defined as a style sheet.
Mac
Code: Select all
<style type="text/css">
body {font-family: Arial, sans-serif; background-color: #FFFFFF; color: #000000}
A:link {color: #0000FF}
A:visited {color: #000066}
A:active {color: #3366FF}
A:hover {color: #0099FF}
</style>Code: Select all
body {
font-family: Arial, sans-serif;
background-color: #FFFFFF;
color: #000000;
}
A:link {color: #0000FF;}
A:visited {color: #000066;}
A:active {color: #3366FF;}
A:hover {color: #0099FF;}Mac
- RandomEngy
- Forum Contributor
- Posts: 173
- Joined: Wed Jun 26, 2002 3:24 pm
- Contact: