Spike Lee
Spike Lee

Reputation: 411

How to apply default CSS styling to all HTML pages

I literally just started learning HTML and I'm making a basic website in Dreamweaver. I would like to know how I can create a default CSS style sheet so it can apply to all web pages. At present I need to make the stylesheet changes to all pages which is troublesome. Would appreciate some references/tutorials on how to do this. Thanks

Upvotes: 0

Views: 9481

Answers (2)

RossDoughty
RossDoughty

Reputation: 73

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

This is probably the best way to include a .css file into your page. However, as far as I know, you have to do it on every page. Please someone clear this for me if you know better :).

Obviously it does mean href="[path to .css file]" if your files are in another place.

Hope this helps,

Ross.

Upvotes: 0

HaaR
HaaR

Reputation: 1453

I would suggest creating a css directory in your websites root (where your index.html page usually is) and adding a css file called style.css.

You will then need to link each of your pages to your newly created stylesheet (style.css) in your section:

<link rel='stylesheet' href='css/style.css' type='text/css' media='screen' charset='utf-8'>

This tells each of your webpages to look for a stylesheet (rel='stylesheet') at the location defined by 'href' (href='css/style.css'), this is assuming that all your files are in the same directory, if not; you'll have to point them to the appropriate place relative to their current location.

For example if you have a folder of 'trips' containing several files 'index.html, map.html' or whichever, they would have to point to "href='../css/style.css'.

Upvotes: 3

Related Questions