MyBB Community Forums

Full Version: Custom CSS isn't working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys,

I've ran into a lot of trouble here.
This is all I wanted to change on MyBB: I didn't like how all of the links followed the same color on the forum for the 'alternating table 1' and '2'. Like, all I wanted to change was the color of the forum link and leave any other linkable things according to the 'alternating table 1' and '2' settings.

Kind of like this:

[Image: mybbprob10zq.gif]
This is how it currently looks. All of the links are the same color (as specified in 'alternating table 1' and '2' in the CSS).

This is how I want it to be:

[Image: mybbprob29nl.gif]
All of the links are still the same color as thee above, EXCEPT for the link to the forum one. That link has its own color (#FFA500 to be exact).

Anyways, in order to accomplish the link color in the forum name as I wanted, I added this extra bit to the CSS:
#forumlink
{
	color: #FFA500;
}
#forumlink a:link
{
	color: #FFA500;
	text-decoration: none;
}
#forumlink a:visited
{
	color: #FFA500;
	text-decoration: none;
}
#forumlink a:active
{
	color: #FFA500;
	text-decoration: underline;
}
#forumlink a:hover
{
	color: #BFBFBF;
	text-decoration: underline;
}
I've already gone through the process of validating the CSS, so it should be 100% right on.

Now, the next thing I did for the 'forum-link-only color change' to take effect was go into the template coding and add the obviously-needed: <div id="forumlink"></div> where applicable.

Well, here's what I did - this is what forumbit_depth2_forum looks like:
<tr>
<td class="$bgcolor" align="center" valign="top"><img src="$theme[imgdir]/$folder.gif" alt="" /></td>
<td class="$bgcolor" valign="top">
<strong><a href="forumdisplay.php?fid=$forum[fid]" id="forumlink">$forum[name]</a></strong><br /><div class="smalltext">$forum[description]$modlist$subforums</div>
</td>
<td class="$bgcolor" valign="top" align="center" nowrap="nowrap">$threads</td>
<td class="$bgcolor" valign="top" align="center" nowrap="nowrap">$posts</td>
<td class="$bgcolor" valign="top" align="right" nowrap="nowrap">$lastpost</td>
</tr>
Notice the: <a href="forumdisplay.php?fid=$forum[fid]" id="forumlink">$forum[name]</a>

Well, for some reason that keeps carrying on down through the whole alternating table (see below):

[Image: mybbprob32jj.gif]

I only want the forum's name to change to the colors as specified in my 'forumlink' CSS. I do not want the subforum links, nor any other links appearing in the 'alternating #' tables to be of the 'forumlink' CSS.

I just want the forum's name to change color. Finito. That simple. Yet the whole 'div id="forumlink"' in the forum link carries on through the whole alternating table.

I know my post was very long for a rather simple problem that I am encountering right now. But if I could get any help here, it would be greatly appreciated.

Thank you,
Andy
I think I see the problem. Your XHTML should not validate. The id attribute needs to be unique across all elements within the page. forumbit_depth2_forum is repeated for every forum at the current depth.

You've created a <div> with id of forumlink, plus assigned that same id to each link for the forum name. This is bad design.

Instead, get rid of that <div> and use a CSS class of forumlink. Then modify your CSS to work with that class.

<tr>
<td class="$bgcolor" align="center" valign="top"><img src="$theme[imgdir]/$folder.gif" alt="" /></td>
<td class="$bgcolor" valign="top">
<strong><a href="forumdisplay.php?fid=$forum[fid]" class="forumlink">$forum[name]</a></strong><br /><div class="smalltext">$forum[description]$modlist$subforums</div>
</td>
<td class="$bgcolor" valign="top" align="center" nowrap="nowrap">$threads</td>
<td class="$bgcolor" valign="top" align="center" nowrap="nowrap">$posts</td>
<td class="$bgcolor" valign="top" align="right" nowrap="nowrap">$lastpost</td>
</tr>
That is what he is doing, he has id="forumlink" in the link's code.

I tried this at my forums, and it worked fine, just how you wanted it. I don't know why it isn't working for you Sad
Yeah, as Belloman pointed out - that's what I already am doing, laie. I don't know why it's not working though. Does it have to be defined as a class since it's in a hyperlink, or does it not matter if it's a class or ID?
alright AndyM3.

1st i'm not sure if u can use "#" dot the classes, so make ur new class lime

.forumlink a:link {
color: #FFA500;
}
just in case.

one more thing
when representing the class in the template , make it this way

find
<strong><a href="forumdisplay.php?fid=$forum[fid]">$forum[name]</a></strong><br />

replace
<span class="forumlink"><strong><a href="forumdisplay.php?fid=$forum[fid]">$forum[name]</a></strong><br /></span>

just rename the class, in this case i have put it forumlink

this thing is workng 100% Smile

bbye
#forumlink means the element with an id of forumlink. In CSS, use a dot to match the class.
well yes that's why i said that # isn't for classesSmile
sorry i wrote dot Toungue instead of for Toungue
regards
The <Span class=""> worked perfectly.
Thank you! Smile