Forum Moderators: not2easy

Message Too Old, No Replies

Specifying which external stylesheet

         

Telemach

12:42 am on Mar 9, 2004 (gmt 0)



Hi,

I've got the following in my head tags...

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

I understand about the last declared style taking precedence, but how can I specify on the page which to use to over-ride the precedence option?
For example, some links on the page use titlestyle.css and the rest I want to use mainstyle.css.
With my current setup of course, all links use mainstyle.css.
I tried naming each style using title="title" in the titlestyle declaration, then sticking <span style="title"> tags around certain links, plus another couple of variations that I could think of, but nothing seems to work.
Can this be done?

Cheers.

rogerdp

3:18 am on Mar 9, 2004 (gmt 0)

10+ Year Member



You can use classes, however there's probably a better solution.

First, about classes. Classes have nothing to do with the title of a stylesheet. See [htmlhelp.com...] and read up about them. The titles of a style sheet are for a name for a user to pick from, so a site can have multiple styles. (Any good, modern browser will allow the user to pick one.)

A better way: It appears you want links to appear differently depending on if they are in your title area or not. Is your title something like..

<div id="masthead">something something <a>something</a> something</div>

If so, in your stylesheet, use:

#masthead a { /*stuff*/ }

This will override less specific styles for <a>.

It is also not a bad idea to have a <div id="content"> (or "body") around everything that is particular to that page. (No ads, site navigation, top-of-page image site banners, etc. If your <h1> is specific to that page, it should be included, otherwise not.)