Forum Moderators: not2easy

Message Too Old, No Replies

Main Link style overriding others

Need to change a link color when I cant place the style inside tag

         

luckless willow

9:13 pm on Jul 28, 2008 (gmt 0)

10+ Year Member



I am very new to coding and this is my first post here. I will try to follow the posting guidelines as much as I can, but I am very unfamiliar with all of this so far. I have been dunked into the position of Graphic Designer for my company and am still learning massive amounts of information every day. The programmers here have a functional use of CSS and have tried to explain what they can but otherwise I'm on my own.

I'm creating templates for my company's website product. For each template I create an XSLT document and a Style Sheet which then pulls information from the database for the variable information on each client, their contact information, etc, etc.

All of the style sheets have:

a:link {
color:#333333;
}

a:visited {
color:#333333;
}

a:hover {
color:#3489df;
}

I can change the style of a link but only when I can put the new class style around the href:

<span class="contact">
<xsl:value-of select="page/contact/email"/>
</span>

However, some of the links on the page are variables and the href coding is not in the XSLT document. Is there a way to override the main link style for a particular table cell? I have tried DIV tags and SPAN tags to no avail.

I appreciate any help on this. I'm currently doing my best to teach myself from Charles Wyke-Smith's Stylin' with CSS.

PS - I'm sorry that I could not provide a DOC TYPE. I could not find it in the sections I work on, and I'm not sure where else to look.

Marshall

6:34 am on Jul 29, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



luckless willow, welcome to WebmasterWorld.

Depending how your overall page structure is, you can create specific links attributes for specific <div>, assuming the <div> has an id. Example

If you have a content division, say #content {}, you can do this:

#content a:link {color: #whatever;}
#content a:visited {color: #whatever;}
#content a:hover {color: #whatever;}

This should affect the links within the #content <div> only, but remember, it will affect ALL the links within that <div>. Insofar as a specific link, that would require directly accessing the HTML and adding either a class="whatever" or an in-line style.

Marshall

luckless willow

2:48 pm on Jul 29, 2008 (gmt 0)

10+ Year Member



Thanks for the welcome and the quick response.

It worked. Using...

.copyright {color: #333333;}
.copyright a:link {color: #333333;}
.copyright a:visited {color: #333333;}
.copyright a:hover {color: #333333;}

made the links visible on their background.

I wasn't sure what '#' actually meant so I've gone searching. I'm currently confusing myself with trying to figure out if I'm overusing classes in my style sheets and where is an appropriate place for class and where should I use an id.

Thanks again.

marcel

3:09 pm on Jul 29, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I wasn't sure what '#' actually meant so I've gone searching.

# is for an id, ie. <p id="myId"> in css #myID{}

. is for class, ie. <p class="myClass"> in css .myClass{}

Marshall

3:15 pm on Jul 29, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hey marcel, thanks for adding that notation - I failed to mention it.

Marshall

luckless willow

4:20 pm on Jul 29, 2008 (gmt 0)

10+ Year Member



Thanks a lot.
The patience is appreciated.

discusgroup

1:39 pm on Aug 6, 2008 (gmt 0)

10+ Year Member



Hi wander if you can assist with a similar thread on this one

I've used style sheets on our site for 6 years now - competent but no expert.

We have a dark background nav bar top and side with white text ahref tags with a style configured in the style sheet

The body of the screen is white and text shows as black. My target is to have ahref tags show as black in this area thus avoiding copious <font> tags.

The site is built with templates to enable central control of navigation but localised creation of content.

The editable area is as follows:

<!-- #BeginEditable "body" -->

<table width="651" border="0" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td>

</td>
</tr>
</table>
<!-- #EndEditable -->

Any suggestions please

D_Blackwell

2:49 pm on Aug 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Really best as a separate thread, but...

1) If I understand the question correctly, you can specify your CSS in an external stylesheet.

2) You want <a> within the <table> to have black text.

In the style sheet:

table#black-link a {
color: #000;
}

In the HTML edit:

<table id="black-link" etcetera

and all <a> within that table will have black text.

...........................

luckless willow -

If the color is #333333 for all states, then you can shorthand to:

.copyright a {
color: #333;}

discusgroup

3:53 pm on Aug 6, 2008 (gmt 0)

10+ Year Member



Many thanks for your speedy response - concise and complete

thanks