-2

i'm developping an e-commerce web site where all the products are displayed in the same page in "cols" the problem is that i couldn't fix the col width or height using CSS

<div class="container">
  <div class="row">
    <!-- BEGIN PRODUCTS -->
    <div
      class="col-md-3 col-sm-6 col-equal"
      *ngFor="let p of (titres | sort: titreSort)"
    >
      <span class="thumbnail">
        <img src="{{ p.URL_couv }}" alt="{{ p.id }}" />
        <h4>
          <label style="display: block; width: 600px;"
            >{{ p.titre }} n° {{ p.numero }}</label
          >
        </h4>

        <p></p>
        <hr class="line" />
        <div class="row">
          <div class="col-md-6 col-sm-6">
            <p class="price"></p>
          </div>
          <div class="col-md-6 col-sm-6"></div>
        </div>
      </span>
    </div>
  </div>
</div>

this is my code

and this is how the products are showing

enter image description here

and this is my CSS code

   

.side-body {
  margin-left: 310px;}
   
.right {
  float: right;
  border-bottom: 2px solid #4b8e4b;
}

.thumbnail {
  -webkit-transition: all 0.5s;
  transition: all 0.5s;
}
.thumbnail:hover {
  opacity: 1;
  box-shadow: 0px 0px 10px #41d834;
}
.line {
  margin-bottom: 5px;
}

@media (max-width: 768px) {
  .col-equal {
    margin: auto;
    display: flex;
    display: -webkit-flex;
    flex-wrap: wrap;
  }
}

Any help please ? Thank you

Maihan Nijat
  • 9,054
  • 11
  • 62
  • 110
Az Emna
  • 527
  • 2
  • 10
  • 26

5 Answers5

2

Try to give min-height to h4, so all the products description will have the same height.

gikall
  • 559
  • 5
  • 16
1

Try setting a min-height to the textblok under the image (description) I think this will solve your problem

Jorn Barkhof
  • 264
  • 1
  • 16
1

seems you are adding all inside the so you need to make the span tag as block or inline-block element

use:

.thumbnail{
display:inline-block;
width:your-width-value;
height:your-height-value;
}
Amit Golhar
  • 799
  • 4
  • 8
  • 21
0

Bootstrap has .row-eq-height for setting equal height on all columns in a row. However, this is not supported by internet explorer.

<div class="container">
  <div class="row row-eq-height">

This could be also fixed by setting flex-wrap: wrap; on the row.

Reference: http://getbootstrap.com.vn/examples/equal-height-columns/

Maihan Nijat
  • 9,054
  • 11
  • 62
  • 110
0

To me it appears that you do not use Bootstrap V4, but in fact V3.

Bootstrap V3 uses float: left, while Bootstrap V4 uses display: flex

codepen.io/HerrSerker/pen/xMyyoM uses Bootstrap V3 (with the issue)
codepen.io/HerrSerker/pen/vbVQYO uses Bootstrap V4 (without the issue)

Maihan Nijat
  • 9,054
  • 11
  • 62
  • 110
yunzen
  • 32,854
  • 11
  • 73
  • 106