MyBB Community Forums

Full Version: Link colour
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I've searched around and nothing seems to work. Basically I need the code to change the colour of individual links.. I've seen it in themes before, but I can't remember the code.

Example:

<a href="http://google.com">Google</a> - That would show up as just "Google" then with the link, but how do I change that INDIVIDUAL link colour.

I know how to change the link colour in global.css, but that effects all the links, I only want one.

Any help would be great.

Thanks.
You may use a mycode for this;

This will change the color of individual link.

Regular Expression:
\[link=(.*?)\](.*?)\[/link\]

Replacement::
<span style="color: $1"><a href="$2">
$2</a></span>

Usage::
[link=COLOR]LINK[/link]

Remember:
COLOR = Should be in hex or in words like; #FF0000 for Red or use red / Red words for Red colors.
LINK: You can add link either in www. format or http:// format.
(2011-01-14, 04:33 PM)Yaldaram Wrote: [ -> ]You may use a mycode for this;

This will change the color of individual link.

Regular Expression:
\[link=(.*?)\](.*?)\[/link\]

Replacement::
<span style="color: $1"><a href="$2">
$2</a></span>

Usage::
[link=COLOR]LINK[/link]

Remember:
COLOR = Should be in hex or in words like; #FF0000 for Red or use red / Red words for Red colors.
LINK: You can add link either in www. format or http:// format.

I don't mean in threads, I mean on the homepage, like the footer copyright for example.
Then you may edit each link like;
<span style="color: COLOR"><a href="LINK_URL_GOES_HERE">LINK_TEXT</a></span>
Tried that: <span style="color:#000000;"><a href="http://www.mybb.com">MyBB</a></span>


But it doesn't work...
Try instead this slightly less stupid version:

<a href="url" style="color: hexOrName;">Link</a>

Or, if that doesn't work exactly like you want, try these:
/* global.css */
#myID:link, #myID:visited {
    color: hexOrName;
}

#myID:hover, #myID:active {
    color: anotherColor;
}

/* Template */
<a href="url" id="myID">Link</a>

The second method may be more complicated but it offers far more control than the first.
(2011-01-14, 07:30 PM)iGeorge Wrote: [ -> ]Tried that: <span style="color:#000000;"><a href="http://www.mybb.com">MyBB</a></span>


But it doesn't work...

You are adding ; after the color code. Remove it.
@Yaldaram - Even without the ";" it didn't work.

Firestryke31's first method worked though.

Thanks.
(2011-01-15, 06:41 AM)Yaldaram Wrote: [ -> ]You are adding ; after the color code. Remove it.

The ';' is simply an "end of attribute" marker, and if a browser fails because of that being present then it is not a CSS-compliant browser.

I tend to add the ';' in case I want to add more attributes after that, but for only a single attribute it's not necessary in the tag's style.
That's why I didn't added Toungue