Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Changing CSS for ONE cat name, so it stands out in the sidebox

Changing CSS for ONE cat name, so it stands out in the sidebox

Locked

Views: 2,086

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
5 Mar 2008, 1:00 AM
#1
innovafire avatar

innovafire

New Zenner

Join Date:
Nov 2007
Location:
Pennsauken, NJ
Posts:
71
Plugin Contributions:
0

Changing CSS for ONE cat name, so it stands out in the sidebox

I tried to follow the directions in the tpl_categories.php file, but no joy. Here's the code:

// to make a specific category stand out define a new class in the stylesheet example: A.category-holiday

// uncomment the select below and set the cPath=3 to the cPath= your_categories_id

// many variations of this can be done

      case ($box_categories_array[$i]['path'] == 'cPath=36'):

        $new_style = 'category-clearance';

        break;

      case ($box_categories_array[$i]['top'] == 'true'):

        $new_style = 'category-top';

        break;

      case ($box_categories_array[$i]['has_sub_cat']):

        $new_style = 'category-subs';

        break;

and the stylesheet addition is:

.category-clearance a:link, .category-clearance a:visited, .category-clearance a:active {
	font-size:larger;
	color:#FF0099;
	}

but there is no change in the category name "clearance" which is what I am trying to effect.

Any suggestions as to what I'm doing wrong?

Chris

7 Mar 2008, 9:20 PM
#2
innovafire avatar

innovafire

New Zenner

Join Date:
Nov 2007
Location:
Pennsauken, NJ
Posts:
71
Plugin Contributions:
0

Re: Changing CSS for ONE cat name, so it stands out in the sidebox

Surely there's somebody here who's got some advice for me on this.

7 Mar 2008, 10:19 PM
#3
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Changing CSS for ONE cat name, so it stands out in the sidebox

You're building the selectors wrong.

Instead of .category-clearance a:link etc, try

a.category-clearance:link, a.category-clearance:visited, a.category-clearance:active {
	font-size:larger;
	color:#FF0099;
	}

.category-clearance a
means a link that is inside the .category-clearance element, but in reality, .category-clearance is the name of the link element itself.

8 Mar 2008, 3:42 AM
#4
innovafire avatar

innovafire

New Zenner

Join Date:
Nov 2007
Location:
Pennsauken, NJ
Posts:
71
Plugin Contributions:
0

Re: Changing CSS for ONE cat name, so it stands out in the sidebox

Ok, I tried your suggestion, but no luck still.

Here's the site, if you want to see:

https://www.cafek9.com

Chris

8 Mar 2008, 4:09 AM
#5
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Changing CSS for ONE cat name, so it stands out in the sidebox

Some other declaration is taking higher prioity than that one, so it is not taking effect.

Add !important to the properties to enforce use of the correct one:```
a.category-clearance:link, a.category-clearance:visited, a.category-clearance:active {
font-size:larger !important;
color:#FF0099 !important;
}

Ideally, you would find out what is conflicting and remove it; sometimes that is not practical.
8 Mar 2008, 4:09 AM
#6
innovafire avatar

innovafire

New Zenner

Join Date:
Nov 2007
Location:
Pennsauken, NJ
Posts:
71
Plugin Contributions:
0

Re: Changing CSS for ONE cat name, so it stands out in the sidebox

Figured it out.

I am using the apple-zen template and, as it has two stylesheets loaded, it for some reason recognized the selector when I put it into the other stylesheet (stylesheet_header_menu.css).

I don't really know WHY this is, but it worked. If anybody does know, please fill me in.

Chris

8 Mar 2008, 4:24 AM
#7
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Changing CSS for ONE cat name, so it stands out in the sidebox

The reason that just moving the declaration worked was that originally, it was before this```
.sideBoxContent, .sideBoxContent a:link, .sideBoxContent a:hover, .sideBoxContent a:visited {
font-size:1.1em;
padding:5px 0;
color:#FFFFFF;
}

.sideBoxContent a:hover {
font-size:1.1em;
padding:5px 0;
color:#FFFF00;
}


It would have worked equally well to just move the specific declaration to below the general one in the same file. That is generally good practice - put general-application styling first, then the exceptions and special cases.
9 Mar 2008, 1:30 AM
#8
innovafire avatar

innovafire

New Zenner

Join Date:
Nov 2007
Location:
Pennsauken, NJ
Posts:
71
Plugin Contributions:
0

Re: Changing CSS for ONE cat name, so it stands out in the sidebox

Ahhh, I see. Thanks for the explaination. I won't make that mistake again.

Chris

8 May 2009, 2:56 AM
#9
donn avatar

donn

Zen Follower

Join Date:
Oct 2007
Posts:
241
Plugin Contributions:
0

Re: Changing CSS for ONE cat name, so it stands out in the sidebox

gjh42:

Some other declaration is taking higher prioity than that one, so it is not taking effect.

Add !important to the properties to enforce use of the correct one:```
a.category-clearance:link, a.category-clearance:visited, a.category-clearance:active {
font-size:larger !important;
color:#FF0099 !important;
}

> Ideally, you would find out what is conflicting and remove it; sometimes that is not practical.

How would this be done if the category name is more than one word, with a space between words?  

(As I understand this, the 'clearance' above is the exact name of a certain category on the site mentioned)

Also...I was unsure...does the categories template file cited above (in the original posting)  need to be changed to do this, or just the style sheet?

Thanks...
8 May 2009, 4:55 AM
#10
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Changing CSS for ONE cat name, so it stands out in the sidebox

The "clearance" has no specific relation to a category's name; it is specified to relate to category id 36 in this case. Category 36 is probably named Clearance, but doesn't have to be.

You can give whatever wording you want to the individual category classname, as long as it doesn't have spaces or some other special characters in it. You would do this in /includes/templates/your_template/sideboxes/tpl_categories.php.
Then you would style a.category-clearance:link etc. in your stylesheet as noted.