How do I move an input field container next to a button so they’re inline and touching each other? As you can see not been able to get the above right with the code below.
.archive .woocommerce-variation-add-to-cart{
display:inline-flex;
}
.archive .qib-container, .archive .single_add_to_cart_button{
float:left;
}
<div class="woocommerce-variation-add-to-cart variations_button woocommerce-variation-add-to-cart-enabled">
<div class="qib-container">
<button type="button" class="minus qib-button">-</button>
<div class="quantity buttons_added">
<label class="screen-reader-text" for="quantity_610094fe7a505">Espresso Taster Pack (x3 Bags) quantity</label>
<input type="number" id="quantity_610094fe7a505" class="input-text qty text" step="1" min="1" max="" name="quantity" value="1" title="Qty" size="4" placeholder="" inputmode="numeric">
<span class="q_inc"></span><span class="q_dec"></span></div>
<button type="button" class="plus qib-button">+</button>
</div>
<button type="submit" class="single_add_to_cart_button button alt">Add to Cart</button>
</div>
4
Answers
Since you only provided HTML code and not the CSS, I made my own CSS that may help you place the quantity text field next to the "Add to cart" button, while also slightly editing the HTML file.
Edited HTML:
All I did here was change the label to a button (though the label text does not appear on the image you sent) and placed the text box inside of it. I also added the Add to Cart button inside of the container.
As for styling:
I added some features to the container that make everything appear side by side. Assuming you change the colors and sizes to fit your need, I think this fixes your problem of the buttons not appearing side by side, but let me know if I interpreted your problem wrong.
This is how it looks:
How about this? Make the buttons and inputs float left.
https://jsfiddle.net/62quL5yn/
In your case you simply need to make
.qib-container
and.woocommerce-variation-add-to-cart
a flexbox container and adjust thewidth
of the input :Here is the full example: