• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

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
0
shiho
Asked:
shiho
  • 4
  • 3
  • 2
  • +1
1 Solution
 
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 new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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
 
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

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now