Cannot change link colors

Started by Krashsite, May 18, 2011, 11:38:21 PM

Previous topic - Next topic

Sir Osis of Liver


Had this problem once before, and managed to work around it with some help, but now it's come up again.  Am unable to change link colors in a template file, either by creating a new class, or wrapping the links in style code.  I can change font size, bg color, but not link colors.

This code is from 1.1.13 Profile.template.php.  The first <tr> is a test line - I can control link colors there.  Below that is the original template code - same class, it applies font size and bg color, but ignores link colors.  It's apparently getting them from somewhere else.



<tr><td colspan="3" height="30" class="ShowPosts"><a href="www.XXX.com">Link</a></td></tr>

<tr class="titlebg2">
<td style="padding: 0 1ex;">
', $post['counter'], '
</td>
<td width="75%" class="ShowPosts">
&nbsp;<a href="', $scripturl, '#', $post['category']['id'], '">', $post['category']['name'], '</a> / <a href="', $scripturl, '?board=', $post['board']['id'], '.0">', $post['board']['name'], '</a> / <a href="', $scripturl, '?topic=', $post['topic'], '.', $post['start'], '#msg', $post['id'], '">', $post['subject'], '</a>
</td>
<td class="middletext" align="right" style="padding: 0 1ex; white-space: nowrap;">
', $txt[30], ': ', $post['time'], '
</td>
</tr>




Here is one of several class variations I tried, which works on the test code, but not the template code -



/* Profile 'Show Posts' links */
.ShowPosts, .ShowPosts a:link, .ShowPosts a:visited, .ShowPosts a:hover, .ShowPosts a:active
{
color:yellow;
font-size:12px;
font-weight:bold;
background-color:#0000ff;
}



What am I missing?

When in Emor, do as the Snamors.
                              - D. Lister

Sir Osis of Liver


Found the style class that's causing the problem -



/* same as titlebg, but used where bold text is not

needed */
.titlebg2 a:link, .titlebg2 a:visited
{
color: black;
font-style: normal;
text-decoration: underline;
}



It's called in the <tr> tag at the top of this section.  Why does it override class in the following <td>?

When in Emor, do as the Snamors.
                              - D. Lister

MrGrumpy

Links start with

<a href

Like the 1 in the first line of your code

<tr><td colspan="3" height="30" class="ShowPosts"><a href="www.XXX.com">Link</a></td></tr>

These use the css

/* Normal, standard links. */
a:link, a:visited


If you want to overide that css you can do this - Im using #000000 (black) as an example

<tr><td colspan="3" height="30" class="ShowPosts"><a style="font-color: #000000;" href="www.XXX.com">Link</a></td></tr>

or

<tr><td colspan="3" height="30" class="ShowPosts"><a class="custom_link" href="www.XXX.com">Link</a></td></tr>

Then add the class in css


.custom_link
{
font-color: #000000;
}

the possession of knowledge is worthless unless imparted upon others
My Custom Themes
2.0 themes only - I don't do 1.1.x

Sir Osis of Liver

Placing the style class inside the link tags is the only thing I didn't try.  Putting it anywhere else has no effect.  These particular links are using the .titlebg2 class that's called in the <tr> tag, which overrides anything else that's placed before the <a> tag.  I'll tinker with it and see how it works.

Thanks.

When in Emor, do as the Snamors.
                              - D. Lister

Advertisement: