Why are my colum contents missing padding to the left, and have extra padding to the right?

Issue

Edit: Here’s the codepen https://codepen.io/maptik/pen/bGKMgpJ

I’m making a react project and I’m trying to use bootstrap to render cards for each item "Producto".

This is how I’m rendering it (I’ve omitted some of the product details so it’s easier to read):

<div className="container bg-color-tienda">
  <div className="center">
    {isLoading ? <h1>CARGANDO PRODUCTOS</h1> : null}
    {!isLoading && productos && productos.length === 0 ? (
      <h5>No hay productos</h5>
    ) : null}
    {!isLoading && productos && productos.length > 0 ? (
      <div className="row">
        {productos.map((producto) => {
          return (
            <div className="col" key={producto.id}>
              <div className="single-producto">
                <div className="card">
                  {/* Thumbnail */}
                  <div className="producto-thumb">
                    {producto.publico === false ? (
                      <div className="producto-tag">No Publicado</div>
                    ) : null}

                    <div className="recipe-image-box">
                      {producto.imageUrl ? (
                        <img
                          src={producto.imageUrl}
                          alt={producto.name}
                          className="recipe-image"
                        />
                      ) : null}
                    </div>
                  </div>
                </div>
              </div>
            </div>
          );
        })}
      </div>
    ) : null}
  </div>
</div>;

The thing is, my custom CSS seems to be messing with the column system. The left padding seems to be missing, while the right padding has increased. This is what it looks like:
enter image description here

As you can see, the left padding is nowhere to be seen, while the right padding is.

This imparity is fixed when I remove this item from my custom CSS, which I use :

.single-producto {
  width: 350px;
  border-radius: 1rem;
  box-shadow: 0 5px 15px rgb(0 0 0 / 5%);
  margin-bottom: 30px;
}

Result:
enter image description here

I hope you can help me, thanks!

Solution

if this is your desire output… you just need to change the width to 100% on .single-producto class

enter image description here

Answered By – Miguel Caro

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published