Bootsrap table text not wrapping on less width - html

Have probably simple question but can't figure out what's wrong. I am using bootstrap table to show the data. The table is responsive and resizing correctly when the user changes the browser size with only one exception which I can't find the solution to.
Look at the picture I liked to. There are 3 states:
1st when looks normally on full browser size
2nd when user would resize - still ok
3rd when it's been resized a lot then it messes up
Link:
https://www.dropbox.com/s/23pj6w2uu0lz716/fine-fullwith.png?dl=0
Counting on your help.
See my code below:
<style type="text/css">
p {
/*padding: 5px;*/
font-size: 13px;
text-align: center;
word-wrap:break-word;
}
.ar {
height: 50px;
}
.table tbody > tr > td.vert-align_td {
vertical-align: middle;
}
.table thead > tr > th.vert-align_th{
vertical-align: middle;
}
</style>
<div class="container-fluid">
<div class="row">
<div class="col-sm-1 col-lg-2">
</div>
<div class="col-sm-11 col-lg-10">
<div class="row">
<div class="col-md-12">
<div class="content-wrapper"></div>
<div class="panel panel-default">
<div class="panel-heading"></div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-bordered table-hover" style="word-wrap: break-word;table-layout: fixed;">
<thead>
<tr>
<th class="col-md-3 text-center vert-align_th">Nazwa transportu</th>
<th class="col-md-2 text-center vert-align_th">Typ transportu</th>
<th class="col-md-2 text-center vert-align_th">Kierowca</th>
<th class="col-md-1 text-center vert-align_th">Numer rejestracyjny</th>
<th class="col-md-1 text-center vert-align_th">Firma spedycyjna</th>
<th class="col-md-1 text-center vert-align_th">Data przyjecia</th>
<th class="col-md-1 text-right vert-align_th">Przycisk</th>
</tr>
</thead>
<tbody>
#For Each item In Model
#<tr>
#*vert-align - look at top in css section*#
<td class="col-md-3 text-center vert-align_td"><a>#item.NazwaTransportu</a></td>
<td class="col-md-2 text-right vert-align_td">#item.TypTransportu</td>
<td class="col-md-2 text-center vert-align_td">#item.Kierowca</td>
<td class="col-md-1 text-center vert-align_td">#item.NumerRejestracyjny</td>
<td class="col-md-1 text-center vert-align_td">#item.FirmaSpedycyjna</td>
<td class="col-md-1 text-center vert-align_td">#item.DataPrzyjecia</td>
<td class="col-md-1 text-center vert-align_td">
<a rel="tooltip" class="btn btn-success btn-xs" href="">
<i class="glyphicon glyphicon-plus icon-color"></i>
dodaj
</a>
</td>
</tr>
Next
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
[1]: http://i.stack.imgur.com/jrybd.png

Bootstrap Tables contain the CSS attribute white-space: nowrap; on every table cell (<td>). This comes by adding the class table-responsive. You can however reset this attribute with the following CSS snippet:
.table tbody > tr > td.vert-align_td,
.table tbody > tr > th.vert-align_th {
white-space: normal;
}

Related

Remove a space white on bootstrap

In a code bootstrap, I wanted to go up the button towards horizontal bar.
enter image description here
<div class="separator-breadcrumb border-top"></div>
<div class="row">
<div class="col-12">
<div class="card mb-4">
<div class="card-body">
<div class="card-title d-flex align-items-center justify-content-end">
<button (click)="showPreviousYear()" *ngIf="showPreviousYearButton()" class="btn btn-primary ">
< {{previousYear}}
</button>
<button (click)="showNextYear()" *ngIf="showNextYearButton()" class="btn btn-primary mx-1">
{{nextYear}} >
</button>
</div>
<div class="table-responsive" *ngIf="lines.length > 0">
<table class="table table-striped">
<thead>
<tr>
<th scope="col" style="width: 25%;">{{'4391' | t}}</th>
<th scope="col" style="width: 25%; text-align: right;">{{'4392' | t}}</th>
<th scope="col" style="width: 25%; text-align: right;">{{'4393' | t}}</th>
<th scope="col" style="width: 25%; text-align: right;">{{'4394' | t}}</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let line of lines; let i = index">
<th style="width: 25%;">
{{line.LIBELLE}}
</th>
<td style="width: 25%; text-align: right;">
{{line.TAUX | number:'1.2-2' | mynamformatnum}} %
</td>
<td style="width: 25%; text-align: right;">
{{line.BASE | number:'1.2-2' | mynamformatnum}} EUR
</td>
<td style="width: 25%; text-align: right;">
{{line.MONTANT | number:'1.2-2' | mynamformatnum}} EUR
</td>
</tr>
</tbody>
</table>
</div>
<h5 *ngIf="lines.length == 0">
{{'4395' | t }}
</h5>
</div>
</div>
</div>
</div>
I added a class btn-top in css
<button (click)="showPreviousYear()" *ngIf="showPreviousYearButton()" class="btn btn-primary btn-top">
And
.btn-top {
position: relative;
top: -100px;
}
Now, I will want to remove the space white of the table, I don't find the class bootstrap to apply that?
enter image description here
For alignment of button, Along with the heading, give the buttons, separate them using col-6
for example
<div class="row">
<div class="col-6">
<h3 class="title">Taxes</h3>
</div>
<div class="col-6">
button
</div>
</div>
And for removing space, as you are using "bootstrap cards" which define padding which create white space so remove that by adding p-0
For example
<div class="card-header p-0">
<div class="card-body p-0">

css of nav-item not correctly applied after screen resize

After resizing the screensize the nav-link buttons don't use the css i gave them anymore. I tried the #media function but it doesn't react on changes in the css after resizing the screen.
(tables are empty, they get filled by the JS code.)
Why is itn't it responding or using the css after resizing the screen?
before resizing (large screen)
after resizing (smaller screen)
In the picture below you can see that there is some interfering with the code but i don't use the #media function at all but it's still using it.
what the browser is seeing
.annuHypoTabellen .nav-link:hover {
background-color: #ff486dad;
color: #fff;
}
.annuHypoTabellen .nav-pills .nav-link.active, .nav-pills .show>.nav-link {
background-color: #de002e;
font-weight: 700;
color: #fff;
}
.annuHypoTabellen .nav-link {
position: relative;
display: block;
margin: 0;
padding: 13px 16px;
background-color: rgba(201, 201, 201, 0.425);
border: 0;
border-radius: 0;
color: #616161;
transition: background-color 0.2s ease;
}
<div class="annuHypoTabellen mt-3">
<div class="row">
<div class="col-md-8 col-xl-9 col-12">
<h4 class="text-gtdirect mt-3 mb-3">
Overzicht totale lasten bij <ins>niet</ins> oversluiten
</h4>
</div>
<div class="col-md-4 col-xl-3 col-12 ml-auto d-flex justify-content-end ">
<ul class="nav nav-pills mb-3 navHypoTabsSmall" id="huidigeHypoTab" role="tablist">
<li class="nav-item">
<a class="nav-link nav-link-annuHypo active" id="pills-jaarHuidigeHypo-tab" data-toggle="pill" href="#pills-jaarHuidigeHypo" role="tab" aria-controls="pills-jaarHuidigeHypo" aria-selected="true">Per Jaar</a>
</li>
<li class="nav-item">
<a class="nav-link nav-link-annuHypo" id="pills-maandHuidigeHypo-tab" data-toggle="pill" href="#pills-maandHuidigeHypo" role="tab" aria-controls="pills-maandHuidigeHypo" aria-selected="false">Per Maand</a>
</li>
</ul>
</div>
</div>
<div class="swipeIcons mb-2">
<div class="row">
<div class="col">
<i class="fas fa-arrow-left fa-lg float-left text-gtdirect pt-1"></i>
</div>
<div class="col">
<h5 class="text-center lead">Scroll</h5>
</div>
<div class="col">
<i class="fas fa-arrow-right fa-lg float-right text-gtdirect pt-1"></i>
</div>
</div>
</div>
<div class="tab-content" id="pills-tabContent">
<div class="tab-pane fade show active" id="pills-jaarHuidigeHypo" role="tabpanel" aria-labelledby="pills-jaarHuidigeHypo-tab">
<div class="anhypoResult">
<div class="scrollBox">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Jaar</th>
<th scope="col">Totale jaar rente</th>
<th scope="col">Totale jaar aflossing</th>
<th scope="col">Schuld ultimo</th>
<th scope="col">Eigen-woning-forfait</th>
<th scope="col">IB-EWF</th>
<th scope="col">IB rente aftrek</th>
<th scope="col">Netto lasten</th>
</tr>
</thead>
<tbody class="annuHuidigeHypoResultTabelJaar">
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="pills-maandHuidigeHypo" role="tabpanel" aria-labelledby="pills-maandHuidigeHypo-tab">
<div class="anhypoResult">
<div class="scrollBox">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Jaar</th>
<th scope="col">Maand</th>
<th scope="col">Rente</th>
<th scope="col">Aflossing</th>
<th scope="col">Schuld ultimo</th>
<th scope="col">Eigen-woning-forfait</th>
<th scope="col">IB-EWF</th>
<th scope="col">IB rente aftrek</th>
<th scope="col">Netto lasten</th>
</tr>
</thead>
<tbody class="annuHuidigeHypoResultTabel">
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>

How to align a checkbox with specified column in table HTML

<div class="col-md-12" style="padding: 10px">
<div class="card m-b-30">
<div class="card-header container-fluid" ">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-12 table-responsive">
<div id="order-listing_wrapper" class="dataTables_wrapper container-fluid dt-bootstrap4 no-footer">
<div class="row">
<div class="col-md-12">
<table id="order-listing" class="table dataTable no-footer table-striped" style="border-bottom:1pt solid black" role="grid" aria-describedby="order-listing_info">
<thead>
<tr role="row">
<th width="70%"><b>Name</b></th>
<th><b>Active</b></th>
<th><b>Select</b></th>
<th><b>Delete</b></th>
</tr>
</thead>
<tbody>
#*#foreach (var item in Model)
{*#
<tr>
<td>
<div class="input-group">
<input type="text" class="form-control" placeholder="Search here" style="width: 450px; height: 40px">
<div class="input-group-append">
<button class="btn btn-secondary" type="button">
<i class="dripicons-search"></i>
</button>
</div>
</div>
</td>
<td>
<input type="checkbox" name="checkbox2">
</td>
</tr>
<tr>
<td>Test New</td>
<td><input class="form-check-input" type="checkbox" id="gridCheck"></td>
<td><button type="button" class="btn btn-icons btn-inverse-secondary" id="data-editbtn-id"><div><i class="icon-pencil"></i></div></button></td>
<td><button type="button" class="btn btn-icons btn-inverse-secondary" id="data-delete-id"><div><i class="dripicons-trash"></i></div></button></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
I tried aligning this checkbox with the Active column but my code doesn't align it with the specified column
whats wrong with my code?
some online HTML generates output the correct code with same code but when i edit it, the aligned doesn't work properly
I have attached my code above can anyone help me im using html and css for this.
Please give the below CSS, the input element is taking CSS of margin-left.
.form-check-input{
margin:0 !important;
}
And also give this CSS
.table td, .table th{
vertical-align: middle;
}

How can I left align the table in html

I have html code which is used to display two tables. When I run the program the two tables appear one below the other, but I want the two tables to be on the extreme left.
<!DOCTYPE html>
<html>
<head>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 50px;
margin-left: auto;
margin-right: auto;
}
td,
th {
border: 1px solid #dddddd;
text-align: center;
padding: 20px;
}
#table {
margin-left: -850px;
}
</style>
<body style="background-color: #E6E6FA">
<div class="container text-center">
<div class="row">
<div class="col-sm-4">
<div class="panel panel-primary">
<div class="panel-heading">Reportees List</div>
<table id="employee_table" class="table table-hover" cellspacing="0">
<tr>
<th>Number</th>
<th>Name</th>
<th>UserId</th>
<th>Count</th>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="jiratable" style="display: none;">
<div class="container text-center">
<div class="row">
<div class="col-sm-4">
<div class="panel panel-primary" style="width: 240%;">
<div class="panel-heading">JIRA - List</div>
<table id="Jira_table" class="table table-hover" cellspacing="0">
<thead>
<tr>
<th width="80">Number</th>
<th>JiraNumber</th>
<th>JiraStatus</th>
<th>EmailId</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="sendmail" style="display: none;">
<div class="container">
<div style="text-align:right; width:100%; padding:0;">
<button id="sendMail" style='margin-right:16px' class="btn btn-
primary btn-lg pull-right">Cancel</button>
<button id="sendMail" class="btn btn-primary btn-lg pull-right" onclick="sendMail()">SendMail</button>
</div>
</div>
</body>
</html>
The output is:
Number Name UserId count
1 Ram 56782 1
2 Raj 56187 2
Expected Output is:
Number Name UserId count
1 Ram 56782 1
2 Raj 56187 2
Here for sample I am writing only one table output, but in actuality there are two tables each, one below the other.
Just remove the margin-left and margin-right. You can also remove the width because tables always automatically are as wide as their content and there's nothing you can do about it.
body {
background-color: #E6E6FA;
}
table {
font-family: arial, sans-serif;
border-collapse: collapse;
}
td,
th {
border: 1px solid #dddddd;
text-align: center;
padding: 20px;
}
#table {
margin-left: -850px;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container text-center">
<div class="row">
<div class="col-sm-4">
<div class="panel panel-primary">
<div class="panel-heading">Reportees List</div>
<table id="employee_table" class="table table-hover" cellspacing="0">
<tr>
<th>Number</th>
<th>Name</th>
<th>UserId</th>
<th>Count</th>
</tr>
</table>
</div>
</div>
</div>
</div>
<div id="jiratable">
<div class="container text-center">
<div class="row">
<div class="col-sm-4">
<div class="panel panel-primary" style="width: 240%;">
<div class="panel-heading">JIRA - List</div>
<table id="Jira_table" class="table table-hover" cellspacing="0">
<thead>
<tr>
<th width="80">Number</th>
<th>JiraNumber</th>
<th>JiraStatus</th>
<th>EmailId</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="sendmail">
<div class="container">
<div style="text-align:right; width:100%; padding:0;">
<button id="sendMail" style='margin-right:16px' class="btn btn-
primary btn-lg pull-right">Cancel</button>
<button id="sendMail" class="btn btn-primary btn-lg pull-right" onclick="sendMail()">SendMail</button>
</div>
</div>
Use float property. In this case, you want to float your element to the left.
<!DOCTYPE html>
<html>
<head>
<style>
table{
font-family:arial,sans-serif;
border-collapse: collapse;
width:50px;
margin-left: auto;
margin-right: auto;
float:left;
}
td,
th{
border:1px solid #dddddd;
text-align: center;
padding: 20px;
}
#table {
margin-left: -850px;
}
</style>
<body style="background-color: #E6E6FA">
<div class="container text-center" >
<div class="row">
<div class="col-sm-4">
<div class="panel panel-primary">
<div class="panel-heading" >Reportees List</div>
<table id = "employee_table" class="table table-hover" cellspacing="0">
<tr>
<th>Number</th>
<th>Name</th>
<th>UserId</th>
<th>Count</th>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div id ="jiratable" style="display: none;">
<div class="container text-center" >
<div class="row">
<div class="col-sm-4">
<div class="panel panel-primary" style="width: 240%;">
<div class="panel-heading">JIRA - List</div>
<table id = "Jira_table" class="table table-hover"
cellspacing="0">
<thead>
<tr>
<th width="80">Number</th>
<th>JiraNumber</th>
<th>JiraStatus</th>
<th>EmailId</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
<div id ="sendmail" style="display: none;">
<div class="container">
<div style="text-align:right; width:100%; padding:0;">
<button id ="sendMail" style='margin-right:16px' class="btn btn-
primary btn-lg pull-right">Cancel</button>
<button id ="sendMail" class="btn btn-primary btn-lg pull-right"
onclick="sendMail()">SendMail</button>
</div>
</div>
</body>
</html>

Center <td> using bootstrap

I'm trying to center some inputs inside a table and set a size to this td using bootstrap (on angularjs) but I can't make it work !
What I have now:
<div class="container">
<form class="form" data-ng-submit="salvarPartida()">
<table class="table table-bordered" align="center">
<tr data-ng-repeat="partida in partidas | filter : {fase : fase}">
<td style="height: 30px; text-align: right; font-size: 10pt;">{{partida.time1.nome}}
<img data-ng-src="/images/bandeiras/{{partida.time1.imgNumber}}.png" style="vertical-align: middle;">
</td>
<td class="col-sm-6">
<div class="col-xs-3" >
<input type="text" class="form-control">
</div>
<div class="col-xs-3">
<input type="text" class="form-control">
</div>
</td>
<br>
<td style="height: 30px; text-align: left; font-size: 10pt;"><img src="/images/bandeiras/{{partida.time2.imgNumber}}.png" title="{{partida.time2.nome}}"
style="vertical-align: middle;"> {{partida.time2.nome}}</td></tr>
</table>
<button class="btn btn-primary btn-block" type="submit">Salvar</button>
<br>
<br>
</form>
</div>
Which looks like:
But my expectations are :
Nevermind the color styles, I'd like just to proper align all fields !
I've tried using align="center" on the , class="text-align" inside the td class, also tried creating a nested into this using the previous text-center class but no luck !
My jsfiddle: fiddle
Thanks so much.
Centering <td> using bootstrap is simple:
horizontally:
<td class="text-center">
vertically:
<td class="align-middle">
Can you try this:
HTML
<div class="container m-con">
<form class="form" data-ng-submit="salvarPartida()">
<table class="table table-bordered">
<tr data-ng-repeat="partida in partidas | filter : {fase : fase}">
<td class="col-sm-4 col-xs-4">
<div class="row m-row">
<div class="col-xs-12 col-sm-4 col-lg-4 col-sm-push-8 text-right">
<img src="http://placehold.it/50x50" alt="" height="50" width="50" />
</div>
<div class="col-xs-12 col-sm-8 col-lg-8 col-sm-pull-4 m-text text-right">
Brazil
</div>
</div>
</td>
<td class="col-sm-4 col-xs-4">
<div class="row">
<div class="col-xs-6 col-sm-6 col-lg-6">
<input type="text" class="form-control" />
</div>
<div class="col-xs-6 col-sm-6 col-lg-6">
<input type="text" class="form-control" />
</div>
</div>
</td>
<td class="col-sm-4 col-xs-4">
<div class="row m-row">
<div class="col-xs-12 col-sm-4 col-lg-4 text-right">
<img src="http://placehold.it/50x50" alt="" height="50" width="50" />
</div>
<div class="col-xs-12 col-sm-8 col-lg-8 m-text text-left">
Brazil
</div>
</div>
</td>
</tr>
</table>
<button class="btn btn-primary btn-block" type="submit">Salvar</button>
</form>
</div>
CSS
.m-con {
margin: 20px;
}
.m-text {
font-size: 16px;
padding-top:15px;
font-weight:bold;
}
.m-con td {
vertical-align:middle !important;
}
#media screen and (max-width:765px) {
.m-row > div {
text-align:center;
}
}
http://jsfiddle.net/vea5G/2/
//use td is padding
td{
vertical-align:middle;
padding:10px 20px;
width:1000px;
}
Try adding up custom CSS:
HTML
<div class="col-xs-3 max-center" >
<input type="text" class="form-control">
</div>
<div class="col-xs-3 max-center">
<input type="text" class="form-control">
</div>
CSS
.max-center {
text-align:center;
}
You can also try adding additional padding to the cells on the sides, but I'm not sure how much because I don't have the images. Just be careful, it can mess up the layout.