Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exclude style a href 1

Status
Not open for further replies.

Bramvg

IS-IT--Management
Jan 16, 2001
135
BE
Hi,

Is it possible to exclude certain styles in a html page?
I have an external css file, which indicates that an <a href> should be bold/black/size 20.

Ofcourse, all links will be changed to this property, but I would like to exclude certain hyperlinks of this setting. Because my layout is completely ruined.

Is theire a way of doing this? (Working with frames is not an option unfortunately).

With many thanks
bram
 
You could just set a different class...

.other {
color: blue
}
.other:hover {
color: red
}

<a class=&quot;other&quot; href=&quot;#&quot;>Link</a>
 
Hi Bram,

you can override the style commands from the external style sheet by using an inline style command on the anchor tags you wish to be different e.g.
Code:
<a href=&quot;#&quot; style=&quot;font-weight:normal; font-size:15px; color:#232323;&quot;>
This will change any attributes you specify inline but will still adopt the settings from the external style sheet. This means you must specify how you want all attributes you want to change.

Alternatively you could reference your own CSS or place a style block in the head of the document you want to affect.
e.g
Code:
<style>
a{font-weight:normal;}
</style>

Hope this helps

Rob :-)
 
Hi aperfectcircle,

Thank you very much, this is extremely helpful!

One more question: I also have an a:hover state, how can I 'say' that for link a 'he' should use a:hover.1 and for the second link a:hover.2 ?

With many thanks in advance!
Bram
 
I'm not sure I understand your question...

In the example I posted above, if you add class=&quot;other&quot; to an <a> tag, it will hover red. The links without class=&quot;other&quot; will display the a:hover setting.

Is this what you were asking? If not, let me know...
 
Hi aperfectcircle


Inderdeed, i just saw it. It's PERFECT.
Sorry that I needed to ask for that, but it's exactly what I needed.

(I'm very happy)

Bram
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top