Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Category bg button image - where to place?

Category bg button image - where to place?

Locked

Views: 2,911

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
7 Mar 2009, 7:13 PM
#1
beyre avatar

beyre

Zen Follower

Join Date:
Feb 2009
Posts:
422
Plugin Contributions:
0

Category bg button image - where to place?

Sorry for this surely simple silly question ...

But am needing to place a simple black button image as the background to the categories, exactly like on their current xcart store: http://www.theironhorseman.com/motorcycle-gear/

Just need to put the image as a background and then center the category name text correctly ....

Sorry for the simple question, but am fighting a terrible headache for 2 days and am just getting frustrated over something I know is simple. :censored: :wacko: :lookaroun

7 Mar 2009, 8:01 PM
#2
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Category bg button image - where to place?

Put the black button image (menu_button.jpg) into your template's images folder. includes/templates/YOUR-TEMPLATE/images

Then, in FIREFOX browser with web developer add-on, play around with the following after sticking it to the very bottom of your stylesheet:

The default display for the category links is INLINE, so you're going to need to change this to "block".

.category-top {background-image: url(../images/menu_button.jpg); display: block; line-height: 40px} (maybe 44px).

NB: There may be other CSS edits too...

7 Mar 2009, 9:43 PM
#3
gjh42 avatar

gjh42

Black Belt

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

Re: Category bg button image - where to place?

And after changing the links from inline to block display, you will need to remove a few <br /> tags from /includes/templates/your_template/sideboxes/tpl_categories.php.

The breaks are necessary to keep the inline links on separate lines, but cause an extra space with block display.

8 Mar 2009, 12:15 AM
#4
beyre avatar

beyre

Zen Follower

Join Date:
Feb 2009
Posts:
422
Plugin Contributions:
0

Re: Category bg button image - where to place?

Thanks so much for your help you two.

Will attempt tomorrow - as I hope this headache will finally take a hike. :unsure:

8 Mar 2009, 6:19 PM
#5
beyre avatar

beyre

Zen Follower

Join Date:
Feb 2009
Posts:
422
Plugin Contributions:
0

Re: Category bg button image - where to place?

Either I've done something wrong, or I'm missing something ...

There was only one <br /> within the categories section of the
/includes/templates/your_template/sideboxes/tpl_categories.php

Can't seem to get the font to show white on the buttons ... and I know several of the category names will need to be on two-lines ...

8 Mar 2009, 6:38 PM
#6
beyre avatar

beyre

Zen Follower

Join Date:
Feb 2009
Posts:
422
Plugin Contributions:
0

Re: Category bg button image - where to place?

AND ... how do I get the sub-categories to stack, indent slightly, and line up nicely under the selected parent category button ?

8 Mar 2009, 6:53 PM
#7
beyre avatar

beyre

Zen Follower

Join Date:
Feb 2009
Posts:
422
Plugin Contributions:
0

Re: Category bg button image - where to place?

ack! It won't do a white font ... :no: :wacko:

8 Mar 2009, 7:14 PM
#8
gjh42 avatar

gjh42

Black Belt

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

Re: Category bg button image - where to place?

We really need to see the site live to answer these questions accurately. A white font is easy if you are putting the property in the right place.

8 Mar 2009, 8:25 PM
#10
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town &amp; London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: Category bg button image - where to place?

Try this for starters:

a.category-top {color: #ffffff;}

(If you need a good tutorial on CSS, go to https://www.w3schools.com).

8 Mar 2009, 8:46 PM
#11
beyre avatar

beyre

Zen Follower

Join Date:
Feb 2009
Posts:
422
Plugin Contributions:
0

Re: Category bg button image - where to place?

Thanks for helping.

I do know CSS, I build websites myself. But when you didn't build the CSS, it's hard to find out what is being controlled where when you didn't label the elements. The FF plugin only helps so far.

Now my sub-cat images are stacking ... and I didn't touch anything that concerns the sub-cat image layout.

runs around in circles screaming :lookaroun

8 Mar 2009, 9:47 PM
#12
gjh42 avatar

gjh42

Black Belt

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

Re: Category bg button image - where to place?

Replace your current category-related styling:```

.category-top {
background-image: url(../images/menu_button.jpg);
display: block;
line-height: 44px;
width: 140px;
margin-left: 4px;
}

a.category-top {
color: #ffffff;
}

#categoriesContent {
color: #FFFFFF;
font-family: arial;
font-size: 11px;
text-align: center;
}
with something like this:

#categoriesContent {
color: #FFFFFF;
font-family: arial;
font-size: 11px;
text-align: left;
}
a.category-top {
background-image: url(../images/menu_button.jpg);
display: block;
height: 44px;
width: 140px;
margin-left: 4px;
text-align: center;
}
a.category-subs, a.category-products {/any special subcat properties here/
}


line-height: 44px; will make each line take up that much space if you need two lines for a title. You just want to control the element height with  height: 44px;