Good evening,
In my shopping cart I notice that when my description is too long it goes beyond the frame.
How do I resolve this in my css?
I think I need to correct this in the css class: eachCart.
Do you have an idea ?
My css
/* Shopping Cart List */
.cartContainer {
position: fixed;
top: 0;
right: 0;
height: 100%;
width: 0;
max-width: 500px;
z-index: 1000;
background-color: #F8F8F8;
display: flex;
flex-direction: column;
align-items: center;
overflow: hidden;
overflow-y: scroll;
scrollbar-width: thin;
transition: all .5s ease-in-out;
}
.showCartContainer {
width: 80%;
padding: 1em;
box-shadow: 0 0 15px 15px rgba(0, 0, 0, .4);
}
.closeCart {
text-align: right;
margin-bottom: 1em;
cursor: pointer;
font-size: 1.1rem;
width: 50px;
float: right;
border-bottom: 2px solid #BA704F;
}
#cartTitle {
font-size: 1.5rem;
color: #BA704F;
font-weight: 900;
}
.eachCart {
width: 97%;
display: grid;
grid-template-columns: 1fr 5fr;
align-items: center;
gap: 5px;
background-color: white;
margin: .5em;
border-radius: 10px;
box-shadow: 0 0 3px 1px rgba(0, 0, 0, .1);
height: 110px;
padding: .5em;
}
.cartImg {
width: 100%;
}
.cartItemName {
font-size: 1rem;
}
.cartItemPrice {
font-weight: 500;
font-weight: bold;
}
.cartDesc {
margin-left: 2em;
color: #DFA878;
}
.remove {
border: none;
background-color: #BA704F;
padding: .5em;
font-size: .9rem;
color: white;
font-weight: bold;
border-radius: 5px;
margin-top: .3em;
cursor: pointer;
border: 2px solid #BA704F;
transition: all .2s ease-in-out;
}
.remove:hover {
color: red;
border: 2px solid #DFA878;
background-color: transparent;
}
#totalPriceContainer {
background-color: #BA704F;
width: 100%;
text-align: center;
padding: 1em;
color: white;
border-radius: 10px;
}
#totalPrice {
font-weight: 900;
}
.back-to-top {
position: fixed;
bottom: 2rem;
right: 2rem;
display: inline-flex;
align-items: center;
justify-content: center;
background-color: #f1bc0d;
border-radius: 0.5rem;
padding: 0.5rem;
text-decoration: none;
transition: 0.2s ease-out;
}
.back-to-top span {
color: #fff;
font-size: 3rem;
transition: 0.2s ease-out;
}
.back-to-top:hover {
background-color: #efc127;
}
.back-to-top:hover span {
transform: translateY(-4px);
}
html code
return eachCartItemContainer.innerHTML +=
`<div class="eachCart">` +
` <img src="./img/${productImg}" class="cartImg" alt="">` +
`<div class="cartDesc">` +
`<h1 class="cartItemName">${productName}</h1>` +
`<p class="cartItemPrice">${productPrice}€</p>` +
`<button class="remove" id="remove${id}">Remove</button>` +
`</div>` +
`</div>`