I have this HTML:
<div class="summary-container">
<div class="product-name">
<h2>Product Name</h2>
<div class="tree">
<a href="#">Computer Components</a>
</div>
</div>
<div class="price-container">
<h4>$ XXXX</h4>
<small>5 left in stock</small>
</div>
<form class="cart-options">
<input id="qty" type="number" min="1" value="1">
<input type="submit" value="Add To Cart">
</form>
</div>
And this CSS:
.summary-container {
display: flex;
outline: 1px dashed;
}
.tree {
padding: 1% 0 2%;
}
.price-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0 1%;
white-space: nowrap;
margin-left: auto;
}
.cart-options {
width: auto;
display: flex;
flex-direction: row;
align-items: center;
margin: 0;
}
input[type="number"] {
display: inline;
text-align: center;
padding: 5% 0;
margin: 0 5%;
width: 3em;
}
input[type="submit"] {
height: 100%;
padding: 0 20%;
}
Now the issue is that due to the padding
and margin
on input[type="number"]
and input[type="submit"]
, the container (.cart-options) overflows. It looks like this:
Notice the gold colored container that goes over the dashed outline of .summary-container
.
How can I make it so that .cart-options does not overflow?
Thanks in advance.