Exluding page-wide CSS



Hello,

How can I create a pocket of HTML that resorts to the usual ALINK, VLINK laws within a page wide set of CSS rules?

Thank you

S
shihoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chewymonCommented:
You can set the attribute in <a> tag. i.e.

<a href="somepage.html" color: red, text-decoration: none>
0
chewymonCommented:
Remember that the point of Cascading Style Sheets is that local attributes override global.

The other option is to define several sets of styles.

A {color:red, text-decorat: none}
A1 {color: blue}

etc...

Then use which ever one you want for a particular effect.
0
shihoAuthor Commented:
Yes, I understand. But this page is governed by a page-wide CSS. However, it also comprises a text menu that I'd like to be rendered in the usual HTML LINK colors. Rather than readjust each and every HREF, isn't there a way to surround these menu links with a <DIV> and enter an antidote for the CSS?

What does the "IMP!" do?

Thanks.

S
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

aarieCommented:
In css, you can use the following terms to address the alink, vlink properties of any <a> attibute:

-----
<style type="text/css">
a:link
{ color : #fffaaa
}

a:active
{ color : #aaafff
}

a:visited
{ color : #bbbccc
}

a:hover
{ color : #cccbbb
}
</style>

-----

This only changes the color of the links... active corresponds with the ALINK, visited with VLINK...
a:hover defines the color the link will get when the mousepointer is over it...
a:link is the color the link is when it has not been visited yet....
Offcourse, you can add a lot more properties than just color...

for more on stylesheets you should check out http://www.w3.org


Arjan.
0
chewymonCommented:
That is the point. For the normal links, you use <a href>.  for the special links you use <a1 href>.  You can define several types of link looks.

However, if you just have a small section you can do this:

<style>
put your style info here.
</style>
Text
text
text


Here is a good discussion of inheiritance and the rules governing it.  His style examples are more accurate than mine.

http://www.webreference.com/content/css/chap2.html

0
shihoAuthor Commented:
Aarie, you're stating something I already knew. The question is: how do I exclude a collection of HREFs from the CSS styles nominated to the entire page?

The answer is: 'Classes'

Chewy, your answer put me on the right track. Care to answer?

Thanks

S
0
nettromCommented:
it's impossible for you to _exclude_ a collection of links from the site-wide/page-wide CSS.  what you do when you use classes is that you specify the same attributes with different values, and due to the cascading in CSS your new values will exclude those of the previous ones that have been defined for the class.

you're therefore, if one is slightly pedantic, not excluding the collection of links, but instead _overriding_ the site-wide/page-wide CSS.

given an example:

<style type="text/css">
a { color: red; background: white; font-size: 84%; font-weight: bold; font-family: Arial, Helvetica, sans-serif; text-decoration: none; }
a.myclass { color: blue; background: white; text-decoration: underline; }
body { color: black; background: white; font-family: "Times New Roman", Times, serif; }
</style>

will the links in class "myclass" be sized to 84% of the default font, and be Arial/Helvetica/sans-serif, or default size and "Times New Roman"/Times/serif?

according to the cascading rules in the CSS level 1 spec (http://tigger.plaindog.no/html/stylesheets/REC-CSS1.html#cascading-order), as far as I can read (and as far as IE4 can show me (my Opera-installation is fubar after my harddrive crash, and I haven't installed IE5 yet)) the style for class "myclass" wil be: 84% sized Arial/Helvetica/sans-serif, blue color on white background, underlined.

why?  because the cascade will apply first the basic definitions, and then let the specific styles for class "myclass" override the basic values.

just a note. :)
0
chewymonCommented:
Glad to help.  I suspect that it will be a year or two before CSS will be reliable in the majority of browsers in use.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
shihoAuthor Commented:
Yeah, I'm with ya.

Thanks again,

SK
0
nettromCommented:
hmmm... I can see that I was way too tired yesterday.  the link to the CSS level 1 spec should of course not point to my local server which doesn't exist, but instead to

http://www.w3.org/TR/REC-CSS1#cascading-order

time for some more caffeine. :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.