Zen Cart Logo
Forums / General Questions / Aligning Quantity Box and Add to Cart Button

Aligning Quantity Box and Add to Cart Button

Locked

Views: 3,413

Results 1 to 15 of 15
This thread is locked. New replies are disabled.
19 Feb 2010, 6:19 PM
#1
eyal8r avatar

eyal8r

Zen Follower

Join Date:
Jan 2010
Posts:
142
Plugin Contributions:
0

Aligning Quantity Box and Add to Cart Button

Man, this seems like a simple thing- but I can't figure it out! I think it's something that's hardcoded into the PHP backend stuff that's causing it.

The Quantity Box is sitting lower than the bottom of my 'Add to Cart' button. Is there a way to align the bottoms of these?
MY SITE IS HERE

I did try to throw this into a UL to help align it- but that didn't seem to work. Any suggestions?

Thanks

19 Feb 2010, 6:37 PM
#2
gjh42 avatar

gjh42

Black Belt

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

Re: Aligning Quantity Box and Add to Cart Button

Add to your stylesheet```
#cartAdd input+input+input {
margin-bottom: -1.0em;
}

And get rid of the <ul> code, as it is not going to do anything for you.
19 Feb 2010, 6:47 PM
#3
eyal8r avatar

eyal8r

Zen Follower

Join Date:
Jan 2010
Posts:
142
Plugin Contributions:
0

Re: Aligning Quantity Box and Add to Cart Button

AWESOME! Glen thank you once again! Do you mind giving a quick explanation of how this works? I'm just trying to learn as I go...
Thanks!

20 Feb 2010, 9:01 AM
#4
gjh42 avatar

gjh42

Black Belt

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

Re: Aligning Quantity Box and Add to Cart Button

The input+input+input is a CSS feature called "adjacent selectors". It means that the rule will only apply (in this case) to a case where there are three <input> elements in a row; then it will apply to the last one of these. If there are four elements in a row, the last two will meet the criteria, as each of them is the third in a set.
You can look at the left navigation on https://www.nyfaeriefest.com for an extreme example of this. The links are set in a slanted column by applying different left padding to each successive line.```
#ezpages li {padding-left: 30px; height: 1.2em;}
#ezpages li+li {padding-left: 25px;}
#ezpages li+li+li {padding-left: 21px;}
#ezpages li+li+li+li {padding-left: 17px;}
#ezpages li+li+li+li+li {padding-left: 14px;}
#ezpages li+li+li+li+li+li {padding-left: 11px;}
#ezpages li+li+li+li+li+li+li {padding-left: 8px;}
...

Note that IE6 does not support adjacent selectors (or a number of other important standard styling features), so all the links fall in one vertical indented column in that antiquated browser. If you really care about making things perfect for IE6, you will have to use some more convoluted methods.
20 Feb 2010, 2:21 PM
#5
eyal8r avatar

eyal8r

Zen Follower

Join Date:
Jan 2010
Posts:
142
Plugin Contributions:
0

Re: Aligning Quantity Box and Add to Cart Button

ok, that makes sense. Now- what is considered a selector? Or how is a selector defined? I see you can apply that to LI and Input... can you apply the same thing to say, text links? Images (ie- img src)? Or even something like <H2> ?

I really appreciate the help!

20 Feb 2010, 2:57 PM
#6
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,099
Plugin Contributions:
56

Re: Aligning Quantity Box and Add to Cart Button

I've found http://www.w3schools.com/ to be a big help in figuring out CSS and HTML constructs ...

20 Feb 2010, 3:55 PM
#8
gjh42 avatar

gjh42

Black Belt

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

Re: Aligning Quantity Box and Add to Cart Button

That article may be ten years old, but Eric Meyer is a CSS god, and pretty much whatever he says is to be studied and learned - not to mention that he makes it easy to understand here.

23 Feb 2010, 3:00 AM
#9
lucky_nz avatar

lucky_nz

New Zenner

Join Date:
Feb 2010
Posts:
40
Plugin Contributions:
0

Re: Aligning Quantity Box and Add to Cart Button

gjh42:

Add to your stylesheet```
#cartAdd input+input+input {
margin-bottom: -1.0em;
}

> And get rid of the <ul> code, as it is not going to do anything for you.

Hello,

I seem to be having the same problem but this doesn't work for me... The "Add to Cart" button on the Listing page (not the product page) is overlapping with the bottom of the quantity box and nothing I try seems to be able to correct it. Could you please tell me what needs to be done in this case?

My URL is http: //66.11.182.82/zen (sorry for the slow loading).

I really appreciate your help and look forward to your answer!
23 Feb 2010, 6:03 AM
#10
gjh42 avatar

gjh42

Black Belt

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

Re: Aligning Quantity Box and Add to Cart Button

With your current (TM) template, there is no add to cart button nor quantity box in the product listing page, only in the product info page. Did you change templates since your post?

If you did mean the product info page, your template has had elements changed around and renamed, so standard style rules will frequently not work on it.

23 Feb 2010, 3:14 PM
#11
lucky_nz avatar

lucky_nz

New Zenner

Join Date:
Feb 2010
Posts:
40
Plugin Contributions:
0

Re: Aligning Quantity Box and Add to Cart Button

Hello, thanks for your reply. I might have mixed up the name or something but I meant the page that is displayed when you go into a category (and, if present, subcategory) and look at the page that contains all of the products in that (sub)category.

I'm sorry if I mixed something up. If that is the listing page, then it's possible that the buttons didn't have enough time to load (because my connection is very slow).

I would really appreciate it if you could please take another look at that page (for example, the lasers or gift certificates category).

Also, what exactly do you mean by > your template has had elements changed around and renamed, so standard style rules will frequently not work on it. I've been told something like this before - is this because I got it from Template Monster? Is there any way to fix this?

Thanks a lot - I really appreciate your help!

23 Feb 2010, 5:03 PM
#12
gjh42 avatar

gjh42

Black Belt

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

Re: Aligning Quantity Box and Add to Cart Button

OK, it was the featured products I was looking at and not seeing qty/add. For your product listing, you can add to your stylesheet_tm.css```
.productListing-data input+input {
position: relative;
top: 0.8em;
}



As for the non-standard part, TM is notorious for rejiggering elements of the page, adding lots of spacer or wrapper divs as if they were tables, and changing the names of even the elements they otherwise don't touch. It is usually possible to restyle TM pages, but you have to learn a whole new set of names, and they are often as meaningful as 
.top1 .r2 .left .inner {}
instead of 
#navMainHeader ul {}
23 Feb 2010, 6:27 PM
#13
lucky_nz avatar

lucky_nz

New Zenner

Join Date:
Feb 2010
Posts:
40
Plugin Contributions:
0

Re: Aligning Quantity Box and Add to Cart Button

Thank you so much - that worked wonderfully!:clap:

And thank you for your advice about Template Monster. By the way, is there any template site you recommend particularly instead of them?

23 Feb 2010, 7:30 PM
#14
gjh42 avatar

gjh42

Black Belt

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

Re: Aligning Quantity Box and Add to Cart Button

No particular one that comes to mind. I haven't worked with that many identified template sources to be familiar with their practices, connected to a name.

24 Feb 2010, 3:32 AM
#15
lucky_nz avatar

lucky_nz

New Zenner

Join Date:
Feb 2010
Posts:
40
Plugin Contributions:
0

Re: Aligning Quantity Box and Add to Cart Button

Ok, well thanks anyway for your help! Besides, I'm stuck with this one anyway for now.