(bootstrap Grid Col-md-4) Alignment Not Working - Stack Overflow

Please Verify your code is like this Now updated the code -- you can view the difference now

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <!--bootstrap 4.0----> <!---this is importent---> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> </head> <style> .border{ border: 1px solid gray; } </style> <body> <nb-card> <nb-card-header> <input nbInput id="search" class="search-input ml-3 mt-2 mb-2" placeholder="Search" #box (keyup)="onKey(box.value)"> </nb-card-header> <nb-card-body> <nb-tabset fullWidth> <nb-tab tabTitle="TabA"> <div class="row"> <div class="col-md-2 col-sm-12 p-2 m-5 border" *ngFor="let item of list_of_detail"> <nb-card status="success" *ngIf="item.env == 'A'"> <nb-card-header> {{ item.host }}</nb-card-header> <nb-card-body> version: {{ item.version }} </nb-card-body> <nb-card-footer>{{ item.service }} | {{ item.region }}</nb-card-footer> </nb-card> </div> </div> </nb-tab> <nb-tab tabTitle="TabB"> <div class="row"> <div class="col-md-4 col-sm-12 p-2 m-5 border" *ngFor="let item of list_of_detail"> <nb-card status="danger" *ngIf="item.env == 'B'"> <nb-card-header> {{ item.host }}</nb-card-header> <nb-card-body> version: {{ item.version }} </nb-card-body> <nb-card-footer>{{ item.service }} | {{ item.region }}</nb-card-footer> </nb-card> </div> </div> </nb-tab> <!-----Bootstrap--> <!---this is importent---> <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script> <!---this is importent---> </body> </html>

you must add css file

<!---bootstrap 4.0----> <!---this is importent---> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

And the script is

<!-----Bootstrap--> <!---this is importent---> <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script> <!---this is importent--->

You will get the answer like you can view the code like this..

View image In Full Screen

Từ khóa » Html Bootstrap Col-md-4