Css Alignment Issue Angular Flexbox - css

I have a following HTML with Angular FlexLayout in it
<div fxLayout="column">
<div fxLayout fxLayoutAlign="space-between">
<span >
3123131
</span>
<span >
1231231
</span>
<span >
6568
</span>
<span >
989
</span>
</div>
<div fxLayoutGap="30px" fxLayout fxLayoutAlign="space-around">
<div class=" line first"></div>
<div class=" line red"></div>
<div class=" line first"></div>
<div class=" line red"></div>
</div>
</div>
<div fxLayout fxLayoutAlign="space-around" fxLayoutGap="20px"
style="border: 1px solid #eee; border-left: none; border-right: none; margin-left: 10px; padding: 10px;">
<span class=" large" style="text-align: left;">
12<span class="small" style="vertical-align: top;">%</span></span>
<span class=" large" style="text-align: right;">
68<span class="small" style="vertical-align: top;">%</span></span>
<span class=" large" style="text-align: left;">
45<span class="small" style="vertical-align: top;">%</span></span>
<span class=" large" style="text-align: right;">
35<span class="small" style="vertical-align: top;">%</span></span>
</div>
<div fxLayout="column" fxLayoutAlign="center">
<div fxLayoutGap="30px" fxLayout fxLayoutAlign="space-around">
<i class="icon thick"></i>
<i class="icon thick"></i>
<i class="icon thick"></i>
<i class="icon thick"></i>
</div>
<div fxLayout fxLayoutAlign="space-around">
<span class=" " style="text-align: right;">
684
</span>
<span class=" ">
3514
</span>
<span class=" ">
21
</span>
<span class=" ">
354
</span>
</div>
</div>
The output of this is as below,
But I want them to be evenly aligned in the same straight line, I can't figure out what mistake I'm making in this
Stackblitz

To make horizontal alignment easier, you can define each item as having no width and a centered content. That can be achieved with an inline-flex container:
.centered {
display: inline-flex;
justify-content: center;
width: 0px;
}
After setting the centered class on the items to align, make sure that you use the same spacing on all lines (either space-around or space-between). This stackblitz shows what it looks like when space-around is used:
<div fxLayout="column">
<div fxLayout fxLayoutAlign="space-around">
<span class="centered">3123131</span>
<span class="centered">1231231</span>
<span class="centered">6568</span>
<span class="centered">989</span>
</div>
<div fxLayout fxLayoutAlign="space-around">
<div class="centered line first"></div>
<div class="centered line red"></div>
<div class="centered line first"></div>
<div class="centered line red"></div>
</div>
</div>
<div fxLayout fxLayoutAlign="space-around" class="percentContainer">
<span class="centered large">12<span class="percent">%</span></span>
<span class="centered large">68<span class="percent">%</span></span>
<span class="centered large">45<span class="percent">%</span></span>
<span class="centered large">35<span class="percent">%</span></span>
</div>
<div fxLayout="column" fxLayoutAlign="center">
<div fxLayout fxLayoutAlign="space-around">
<i class="centered icon thick"></i>
<i class="centered icon thick"></i>
<i class="centered icon thick"></i>
<i class="centered icon thick"></i>
</div>
<div fxLayout fxLayoutAlign="space-around">
<span class="centered">684</span>
<span class="centered">3514</span>
<span class="centered">21</span>
<span class="centered">354</span>
</div>
</div>

Related

How to use MDBootstrap Chat dynamically?

I am trying to user MdBootstrap 5's chat feature in my app.
This is what I have tried in the template but the thing is I need to refresh the page for it to work even though I am using SignalR in my backend.
<section style="background-color: #eee;">
<div class="container py-5">
<div class="row d-flex justify-content-center">
<div class="col-md-10 col-lg-8 col-xl-6">
<div class="card" id="chat2">
<div class="card-header d-flex justify-content-between align-items-center p-3">
<h5 class="mb-0">Chat</h5>
<button type="button" class="btn btn-primary btn-sm" data-mdb-ripple-color="dark">
Let's Chat
App
</button>
</div>
<div class="card-body" data-mdb-perfect-scrollbar="true" style="position: relative; height: 400px">
<div *ngFor="let message of (messageService.messageThread$ | async)">
<ng-container *ngIf="message.senderUsername !== currentUser!.userName">
<div class="d-flex flex-row justify-content-start">
<img src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-chat/ava3-bg.webp"
alt="avatar 1" style="width: 45px; height: 100%;">
<div>
<p class="small p-2 ms-3 mb-1 rounded-3" style="background-color: #f5f6f7;">ouweee {{message.content}}</p>
<p class="small ms-3 mb-3 rounded-3 text-muted">{{message.messageSent | date:'medium'}}</p>
<span class="text-danger" *ngIf="!message.dateRead">(unread)</span>
<span class="text-success" *ngIf="message.dateRead">(read {{message.dateRead + 'Z' | timeago}})</span>
</div>
</div>
</ng-container>
<ng-container *ngIf="message.senderUsername === currentUser!.userName">
<div class="d-flex flex-row justify-content-end mb-4 pt-1">
<div>
<p class="small p-2 me-3 mb-1 text-white rounded-3 bg-primary"> Nouwweee {{message.content}}</p>
<p class="small me-3 mb-3 rounded-3 text-muted d-flex justify-content-end">{{message.messageSent | date:'medium'}}</p>
<span class="text-danger" *ngIf="!message.dateRead">(unread)</span>
<span class="text-success" *ngIf="message.dateRead">(read {{message.dateRead + 'Z' | timeago}})</span>
</div>
<img src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-chat/ava4-bg.webp"
alt="avatar 1" style="width: 45px; height: 100%;">
</div>
</ng-container>
</div>
<form [formGroup]="messageForm" enctype="multipart/form-data" (ngSubmit)="createNewMessage()">
<div class="card-footer text-muted d-flex justify-content-start align-items-center p-3">
<img src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-chat/ava3-bg.webp"
alt="avatar 3" style="width: 40px; height: 100%;">
<input type="text" class="form-control form-control-lg" id="exampleFormControlInput1"
placeholder="Type message" formControlName="content" name="content">
<a class="ms-1 text-muted" href="#!"><i class="fas fa-paperclip"></i></a>
<a class="ms-3 text-muted" href="#!"><i class="fas fa-smile"></i></a>
<button class="btn btn-primary" type="submit">Send</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
This is the page from which I extracted the MDBootstrap template :
https://mdbootstrap.com/docs/standard/extended/chat
Thanks for your time

bootstrap pull-left and pull-right class not working in angular

so basically im doing this in angular and using bootstrap
I want the name and description on the left and img on the right but it isn't working , pls help
code link is below
here
<div class="row">
<div class="col-xs-12">
<button class='btn btn-success'>New bug</button>
</div>
</div>
<hr>
<div class="row">
<div class="col-xs-12">
<a href="#" class="list-group-item clearfix"
style="background:grey ; color:red;"
*ngFor="let bug of bugs">
<div class="pull-left">
<h4 class="list-group-item-headin">name</h4>
<p class="list-group-item-text">description</p>
<span class="list-group-item-text">type</span>
<span class="list-group-item-text">status</span>
<span class="list-group-item-text">priority</span> </div>
<div class="pull-right">
<img src="https://upload.wikimedia.org/wikipedia/commons/3/3f/Dead-Bug_43215-480x360_%285000576310%29.jpg"
alt="{{bug.name}}"
class="img-responsive"
style="max-height: 100px;">
</div>
</a>
<app-bugs-item></app-bugs-item>
</div>
</div>
I'm guessing you want the text to wrap around the image. If that is the case then only put the float class on the image, and reorder the image to above the text.
<div class="container">
<div class="row">
<div class="col-xs-12">
<button class="btn btn-success">New bug</button>
</div>
</div>
<hr />
<div class="row">
<div class="col-xs-12">
<a href="#" class="list-group-item clearfix" style="background: grey; color: red" *ngFor="let bug of bugs">
<div class="float-right">
<img src="https://upload.wikimedia.org/wikipedia/commons/3/3f/Dead-Bug_43215-480x360_%285000576310%29.jpg" alt="{{bug.name}}" class="img-responsive" style="max-height: 100px" />
</div>
<h4 class="list-group-item-headin">name</h4>
<p class="list-group-item-text">description</p>
<span class="list-group-item-text">type</span>
<span class="list-group-item-text">status</span>
<span class="list-group-item-text">priority</span>
</a>
<app-bugs-item></app-bugs-item>
</div>
</div>
</div>
If you want the text and image to be in 2 columns I would suggest using flexbox
<div class="container">
<div class="row">
<div class="col-xs-12">
<button class="btn btn-success">New bug</button>
</div>
</div>
<hr />
<div class="row">
<div class="col-xs-12">
<a href="#" class="list-group-item d-flex justify-content-between" style="background: grey; color: red" *ngFor="let bug of bugs">
<div>
<h4 class="list-group-item-headin">name</h4>
<p class="list-group-item-text">description</p>
<span class="list-group-item-text">type</span>
<span class="list-group-item-text">status</span>
<span class="list-group-item-text">priority</span>
</div>
<div>
<img src="https://upload.wikimedia.org/wikipedia/commons/3/3f/Dead-Bug_43215-480x360_%285000576310%29.jpg" alt="{{bug.name}}" class="img-responsive" style="max-height: 100px" />
</div>
</a>
<app-bugs-item></app-bugs-item>
</div>
</div>
</div>

IE11 issue with flex-box screen doesnt fit properly Angular8

I am facing an issue with CSS issue in IE11, all other browsers it works correctly.
The issue is due to string length the screen doesnt fit in the browser properly.
I tried setting display:flex,flex: 1 1 auto, flex-wrap:wrap, white-space:pre-wrap to the parent div whose span has the long string.
Please help me to troubleshoot this.
I have also copied the IE11 generated HTML.
Note: The screenshot is cropped version.
HTML markup:
<div class="row pad1-0" _ngcontent-ean-c19="">
<aside class="col-md-3 ng-star-inserted" id="sidebar" style="top: 0px;" _ngcontent-ean-c19="">
<div class="toggle-side" _ngcontent-ean-c19="">
<i class="fa fa-bars" _ngcontent-ean-c19=""></i>
</div>
<ul class="participant-menu popmenu" _ngcontent-ean-c19="">
<li class="menu-item ia-language saved" data-goto="ia-language" _ngcontent-ean-c19="">
Languages</li>
</ul>
</aside>
<main class="col-md-9 ng-star-inserted" id="main" _ngcontent-ean-c19="">
<section class="overview-options pad2-0 tright" _ngcontent-ean-c19="">
<div class="btn-group" role="group" _ngcontent-ean-c19="">
<button class="btn btn-secondary" onclick="window.print();" _ngcontent-ean-c19="">
<i class="fa fa-print" _ngcontent-ean-c19=""></i> Print</button>
<!--bindings={
"ng-reflect-ng-if": "true"
}--><button disabled="" class="btn btn-success btn-submit ng-star-inserted" _ngcontent-ean-
c19="">
<i class="fa fa-paper-plane" _ngcontent-ean-c19=""></i> Submit</button>
</div>
</section>
<app-languages-overview ng-reflect-model-errors="[object Object]" ng-reflect-has-edit-access="true"
ng-reflect-section="[object Object]" ng-reflect-validation-manager="[object Object]" ng-reflect-has-
fcdp-role="false" _ngcontent-ean-c19="" _nghost-ean-c21=""><section class="overview ia fields
language current" id="ia-language" _ngcontent-ean-c21="">
<app-overview-card-header ng-reflect-title="Languages" ng-reflect-is-edit-hidden="true" ng-reflect-
row-version="AAAAAABxc2A=" _ngcontent-ean-c21="" _nghost-ean-c35=""><div class="partTitle flex-row"
_ngcontent-ean-c35="">
<span class="secTitle" _ngcontent-ean-c35="">Languages</span>
<div class="flex-row history-dropdown ng-star-inserted" _ngcontent-ean-c35=""></div>
<nav class="right" _ngcontent-ean-c35="">
<a class="ng-star-inserted" _ngcontent-ean-c35=""><i class="fa fa-history" _ngcontent-ean-c35="">
</i></a>
<a class="ng-star-inserted" _ngcontent-ean-c35=""><i class="fa fa-pencil-alt" _ngcontent-ean-
c35=""></i></a>
<a class="ng-star-inserted" _ngcontent-ean-c35=""><i class="fa fa-compress ng-star-inserted"
_ngcontent-ean-c35=""></i></a>
</nav>
</div>
</app-overview-card-header>
<div class="part language border-right ng-star-inserted" _ngcontent-ean-c21="">
<div class="flex-row overviewContainer ng-star-inserted" _ngcontent-ean-c21="">
<div class="overview-field flex-row col-md-6 overviewItem" _ngcontent-ean-c21="">
<span title="What language do you use at home?" class="ovtitle" _ngcontent-ean-c21="">Home
Language</span>
<span class="ovval" _ngcontent-ean-c21="">English </span>
</div>
<div class="overview-field flex-row col-md-2 overviewItem" _ngcontent-ean-c21="">
<span title="Read" class="ovtitle" _ngcontent-ean-c21="">Read</span>
<span class="ovval" _ngcontent-ean-c21="">Yes </span>
</div>
<div class="overview-field flex-row col-md-2 overviewItem" _ngcontent-ean-c21="">
<span title="Write" class="ovtitle" _ngcontent-ean-c21="">Write</span>
<span class="ovval" _ngcontent-ean-c21="">Yes </span>
</div>
<div class="overview-field flex-row col-md-2 overviewItem" _ngcontent-ean-c21="">
<span title="Speak" class="ovtitle" _ngcontent-ean-c21="">Speak</span>
<span class="ovval" _ngcontent-ean-c21="">Yes </span>
</div>
</div>
<div class="ng-star-inserted" _ngcontent-ean-c21="">
<div class="flex-row overviewContainer ng-star-inserted" _ngcontent-ean-c21="">
<div class="overview-field flex-row col-md-6 caret overviewItem blank" _ngcontent-ean-c21="">
<span title="List any other languages you know" class="ovtitle" _ngcontent-ean-c21="">Other
Language
</span>
<span class="ovval" _ngcontent-ean-c21=""> </span>
</div>
<div class="overview-field flex-row col-md-2 overviewItem blank" _ngcontent-ean-c21="">
<span title="Read" class="ovtitle" _ngcontent-ean-c21="">Read</span>
<span class="ovval" _ngcontent-ean-c21=""> </span>
</div>
<div class="overview-field flex-row col-md-2 overviewItem blank" _ngcontent-ean-c21="">
<span title="Write" class="ovtitle" _ngcontent-ean-c21="">Write</span>
<span class="ovval" _ngcontent-ean-c21=""> </span>
</div>
<div class="overview-field flex-row col-md-2 overviewItem blank" appHistoryData="" _ngcontent-
ean-c21="">
<span title="Speak" class="ovtitle" _ngcontent-ean-c21="">Speak</span>
<span class="ovval" _ngcontent-ean-c21=""> </span>
</div>
</div>
</div>
<div class="flex-row overviewContainer" _ngcontent-ean-c21=""></div>
<div class="flex-row overviewContainer" _ngcontent-ean-c21="">
<div class="overview-field flex-row col-md-12 overviewItem blank" _ngcontent-ean-c21="">
<span title="Notes" class="ovtitle" _ngcontent-ean-c21="">Notes</span>
<span class="ovval" _ngcontent-ean-c21=""> </span>
</div>
</div>
</div>
</section>
</app-languages-overview>
<app-ncp-overview style="overflow: hidden; display: flex; align-items: stretch;" ng-reflect-model-
errors="[object Object]" ng-reflect-has-edit-access="true" ng-reflect-section="[object Object]" ng-
reflect-validation-manager="[object Object]" ng-reflect-has-fcdp-role="false" _ngcontent-ean-c19=""
_nghost-ean-c33=""><section class="overview ia fields ncp current ng-star-inserted" id="ia-ncp"
_ngcontent-ean-c33="">
<app-overview-card-header ng-reflect-title="Non-Custodial Parents" ng-reflect-is-edit-hidden="true"
ng-reflect-row-version="AAAAAABxggI=" _ngcontent-ean-c33="" _nghost-ean-c35=""><div
class="partTitle flex-row" _ngcontent-ean-c35="">
<span class="secTitle" _ngcontent-ean-c35="">Non-Custodial Parents</span>
<a class="ng-star-inserted" _ngcontent-ean-c35=""><i class="fa fa-pencil-alt" _ngcontent-ean-c35="">
</i></a>
<a class="ng-star-inserted" _ngcontent-ean-c35=""><i class="fa fa-compress ng-star-inserted"
_ngcontent-ean-c35=""></i><!--bindings={
"ng-reflect-ng-if": "false"
}--></a>
</nav>
</div>
</app-overview-card-header>
<div class="part ncp ng-star-inserted" style="flex:1 1 0px; overflow: hidden; display: flex; flex-
direction: row;" _ngcontent-ean-c33="">
<div class="ng-star-inserted" _ngcontent-ean-c33="">
<div class="caretaker ng-star-inserted" _ngcontent-ean-c33="">
<div class="row" _ngcontent-ean-c33="">
<div class="overview-field col-md-4" style="display: flex; flex-direction: row;"
_ngcontent-ean-c33="">
<span title="Relationship to Child(ren)" class="ovtitle" _ngcontent-ean-
c33="">Relationship to Child(ren)</span>
<span class="ovval" _ngcontent-ean-c33="">Other Parent </span>
</div>
<div class="overview-field col-md-8" style="flex:1 1 0px; overflow: hidden; display:
flex; flex-direction: row; align-items: stretch;" _ngcontent-ean-c33="">
<span title="Relationship to Child(ren) - Details" class="ovtitle" _ngcontent-ean-
c33="">Details</span>
<span class="ovval" _ngcontent-ean-c33="">fdsfadsfdsfdfdfdsfdsfsdfdfdfdsfsdfsdfsdfdsfdsfdsfdsfasdfsdfasdfsfsdffdsfadsfdsfdfdfdsfdsfsdfdfdfdsfsdfsdfsdfdsfdsfdsfdsfasdfsdfasdfsfsdffdsfadsfdsfdfdfdsfdsfsdfdfdfdsfsdfsdfsdfdsfdsfdsfdsfasdfsdfasdfsfsdffdsfadsfdsfdfdfdsfdsfsdfdfdfdsfsdfsdfsdfdsfdsfdsfdsfasdfsdfasdfsfsdffdsfadsfdsfdfdfdsfdsfsdfdfdfdsfsdfsdfsdfdsfdsfdsfdsfasdfsdfasdfsfsdffdsfadsfdsfdfdfdsfdsfsdfdfdfdsfsdfsdfsdf </span>
</div>
</div>
</div>
</div><div class="row" _ngcontent-ean-c33=""></div>
<div class="row" _ngcontent-ean-c33=""></div>
</div>
</section>
</app-ncp-overview>
</main>
</div>
I was able to fix this issue, the word-break: break-word; was causing the issue in IE11,
i changed it to word-break: break-all; and it started working..spent 3 hrs on this :)

height alignment issue while displaying the products

I am doing an eCommerce project. While displaying the products list, if I insert any content inside, height will vary and total alignment is disturbed.
You can see the code below. I'm using bootstrap 4.
#product_list {
width: 210px;
margin-right: 0px;
font-size: 14px;
}
.product-item {
width: 100%;
height: 350px;
cursor: pointer;
background-color: #FFFFFF;
}
.product {
width: 100%;
height: 350px;
border: solid 2px #e9e9e9;
}
.product_image {
width: 100%;
text-align: center;
}
.product_image img {
width: 70%;
height: 70%;
}
<!-- Start to products display -->
<ul class="inline-item pt-2" style="padding-left:0px;padding-right:0px;" id="product_list_grid">
<li class="list-inline-item mb-1" id="product_list">
<div class="product-item mb-1">
<div class="product">
<div class="product_image">
<img src="images/FREEDOM.png" alt="">
</div>
<div class=" text-center mb-0 ">
<h6 class="product_brand"><a class="text-dark" href="single.html">Ashirvad</a></h6>
<h6 class="product_name">
<p class="card-text m-0">
<label> Ahirvad </label>
<button type="button" class="btn btn-sm text-white " id="background_color" data-toggle="modal" data-target="#myModal1"> 1kg </button>
</p>
</h6>
<p class=" mb-0">
<span>20pc/Box</span> ❙ <span>Min 5 boxes</span>
</p>
<div class="product_price">
<span>MRP : <del>$50</del></span> ❙ <span> <b> Sale : $40 </b> </span>
</div>
<div class="quantity mb-1 ">
<input type="button" value="-" class="minus " style="border-radius:50px;">
<span> 1 </span>
<input type="button" value="+" class="plus" style="border-radius:50px;">
</div>
<div class=" text-center my-2 ">
<a class="btn btn-sm text-white" id="background_color" href="#">add to cart</a>
</div>
</div>
</div>
</div>
</li>
<li class="list-inline-item mb-1" id="product_list">
<div class="product-item mb-1">
<div class="product">
<div class="product_image">
<img src="images/FREEDOM.png" alt="">
</div>
<div class=" text-center mb-0 ">
<h6 class="product_brand"><a class="text-dark" href="single.html">Ashirvad</a></h6>
<h6 class="product_name">
<p class="card-text m-0">
<label> Ahirvad </label>
<button type="button" class="btn btn-sm text-white " id="background_color" data-toggle="modal" data-target="#myModal1"> 1kg </button>
</p>
</h6>
<p class=" mb-0">
<span>20pc/Box</span> ❙ <span>Min 5 boxes</span>
</p>
<div class="product_price"> <span>MRP : <del>$50</del></span> ❙ <span> <b>
Sale : $40 </b> </span> </div>
<div class="quantity mb-1 ">
<input type="button" value="-" class="minus " style="border-radius:50px;">
<span> 1 </span>
<input type="button" value="+" class="plus" style="border-radius:50px;">
</div>
<div class=" text-center my-2 "><a class="btn btn-sm text-white" id="background_color" href="#">add to cart</a></div>
</div>
</div>
</div>
</li>
........
</ul>
This the code I am using to display the products ,while displaying if the list items content and images everything same it will display clearly. If I insert any content inside height alignment issue is arising.
<ul class="inline-item pt-2 d-flex flex-wrap" style="padding-left:0px;padding-right:0px;" id="product_list_grid">
<li class="list-inline-item mb-1" id="product_list">
<div class="product-item mb-1">
<div class="product">
<div class="product_image">
<img src="images/FREEDOM.png" alt="">
</div>
<div class=" text-center mb-0 ">
<h6 class="product_brand"><a class="text-dark" href="single.html">Ashirvad</a></h6>
<h6 class="product_name">
<p class="card-text m-0">
<label> Ahirvad </label>
<button type="button" class="btn btn-sm text-white " id="background_color"
data-toggle="modal" data-target="#myModal1">
1kg
</button>
</p>
</h6>
<p class=" mb-0">
<span>20pc/Box</span> ❙ <span>Min 5 boxes</span>
</p>
<div class="product_price"> <span>MRP : <del>$50</del></span> ❙ <span> <b>
Sale : $40 </b> </span> </div>
<div class="quantity mb-1 ">
<input type="button" value="-" class="minus " style="border-radius:50px;">
<span> 1 </span>
<input type="button" value="+" class="plus" style="border-radius:50px;">
</div>
<div class=" text-center my-2 "><a class="btn btn-sm text-white" id="background_color"
href="#">add
to cart</a></div>
</div>
</div>
</div>
</li>
<li class="list-inline-item mb-1" id="product_list">
<div class="product-item mb-1">
<div class="product">
<div class="product_image">
<img src="images/FREEDOM.png" alt="">
</div>
<div class=" text-center mb-0 ">
<h6 class="product_brand"><a class="text-dark" href="single.html">Ashirvad</a></h6>
<h6 class="product_name">
<p class="card-text m-0">
<label> Ahirvad </label>
<button type="button" class="btn btn-sm text-white " id="background_color"
data-toggle="modal" data-target="#myModal1">
1kg
</button>
</p>
</h6>
<p class=" mb-0">
<span>20pc/Box</span> ❙ <span>Min 5 boxes</span>
</p>
<div class="product_price"> <span>MRP : <del>$50</del></span> ❙ <span> <b>
Sale : $40 </b> </span> </div>
<div class="quantity mb-1 ">
<input type="button" value="-" class="minus " style="border-radius:50px;">
<span> 1 </span>
<input type="button" value="+" class="plus" style="border-radius:50px;">
</div>
<div class=" text-center my-2 "><a class="btn btn-sm text-white" id="background_color"
href="#">add
to cart</a></div>
</div>
</div>
</div>
</li>
</ul>
<style>
/* Start to css for product list */
#product_list {width:210px;
margin-right: 0px;
font-size: 14px;}
.product-item
{
width: 100%;
height: 350px;
cursor: pointer;
background-color: #FFFFFF;
}
.product {
width: 100%;
height: auto;
border: solid 2px #e9e9e9;
max-height: 600px;
}
.product_image
{
width: 100%;
text-align: center;
}
.product_image img
{
width: 70%;
height:70%;
}
/* END to css for product list */
</style>
use "d-flex" and "flex-wrap" class for ul tag. and use max-height instead of height.
I hope it would be helpful.

get rid of white space in thumbnail

I'm trying to get rid of extra white space in an img-thumbnail. I adjusted padding in bootstrap.css but nothing changed ! How can I force it to remove this big space ?
bootstrap.css
.img-thumbnail {
display: inline-block;
max-width: 100%;
padding: 3px;
line-height: 1.42857143;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
-webkit-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
}
view page
<% #store.products.each_with_index do |product,index| %>
<div class="col-sm-4">
<div class="img-thumbnail">
<%= link_to image_tag(root_url + "/images/" + product.filename, size: "200x150", alt: product.filename), product %>
<div class="caption">
<h4 class="pull-right">$ <%= product.price %></h4>
<h4><%= product.name %></h4>
<div id="star-img">
<% if current_user != product.store.user %>
<%= rating_for product, "overall", :enable_half => false,:disable_after_rate => false %>
<% end %>
</div>
</div>
</div>
</div>
<%end %>
A screen shot http://postimg.org/image/4ih2jd481/
how can I decrease padding between each thumbnail as well. I tried to add right-padding and set a low number of pixels, it would not work either.
It's most likely the columns that need to have any padding reduced. You can use CSS Attribute Selectors to accomplish this. See MDN for more information. See the second working example labeled Thumbnail Example that applies specifically to your issue.
Basic Example:
.some-class > [class*='red'] {
background: red;
}
.another-class {
background: green;
}
<div class="some-class">
<div class="no-class">
NOT RED
</div>
<div class="red">
RED
</div>
<div class="another-class">
GREEN
</div>
<div class="red">
RED
</div>
<div class="no-class">
NOT RED
</div>
<div class="no-class">
NOT RED
</div>
<div class="another-class">
GREEN
</div>
</div>
Sidenote: You may want to consider using the thumbnail class instead of img-thumbnail since it appears to cover your use case. And you may need to clear your columns if the thumbnails are dynamically generated and vary in height.
Thumbnail Example:
body {
padding-top: 25px;
}
.thumbnail-gutter > [class*='col-'] {
padding-right: 4px;
padding-left: 4px;
}
.thumbnail-gutter .thumbnail {
border: 4px solid #f00;
}
#media (min-width: 768px) and (max-width: 1199px) {
.thumbnail-gutter .col-sm-4:nth-child(3n+1) {
clear: left
}
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row thumbnail-gutter">
<div class="col-sm-4">
<div class="thumbnail">
<img src="http://placehold.it/750x375/000/fff">
<div class="caption">
<h4 class="pull-right">$100.00</h4>
<h4>ONE NAMENAMENAME</h4>
<div id="star-img">
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="thumbnail">
<img src="http://placehold.it/750x375/ff0/fff">
<div class="caption">
<h4 class="pull-right">$5.00</h4>
<h4>TWO NAMENAME NAME</h4>
<div id="star-img">
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="thumbnail">
<img src="http://placehold.it/750x375/f00/fff">
<div class="caption">
<h4 class="pull-right">$55.00</h4>
<h4>THREE NAMENAME</h4>
<div id="star-img">
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="thumbnail">
<img src="http://placehold.it/750x375/ff0/fff">
<div class="caption">
<h4 class="pull-right">$5.00</h4>
<h4>FOUR NAMENAME NAMENAME NAMENAME</h4>
<div id="star-img">
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="thumbnail">
<img src="http://placehold.it/750x375/000/fff">
<div class="caption">
<h4 class="pull-right">$55.00</h4>
<h4>FIVE NAMENAME</h4>
<div id="star-img">
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="thumbnail">
<img src="http://placehold.it/750x375/f00/fff">
<div class="caption">
<h4 class="pull-right">$5.00</h4>
<h4>SIX NAMENAME NAMENAME NAMENAME NAMENAME</h4>
<div id="star-img">
<span class="fa fa-star-o"></span>
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="thumbnail">
<img src="http://placehold.it/750x375/444/f00">
<div class="caption">
<h4 class="pull-right">$55.00</h4>
<h4>SEVEN NAMENAME NAMENAME</h4>
<div id="star-img">
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
<span class="fa fa-star-o"></span>
</div>
</div>
</div>
</div>
</div>
</div>

Resources