Bootstrap: center <h3> underneath table - html

Link
Heres the website containing the full html rendered Link
Here's my code:
<template name="activeOrderTable"><table class="table">
<thead>
<tr>
<th>Commodity</th>
<th>Quantity</th>
<th>Price (High Quality Metal)</th>
<th>Order Type</th>
<th>Merchant</th>
<th>Location</th>
<th>Date Added</th>
</tr>
</thead>
<tbody>
{{#each activeOrders}}
<tr>
<td>{{prettifyCommodity commodity}}</td>
<td>{{quantity}}</td>
<td>{{price}}</td>
<td>{{prettifyOrderType orderType}}</td>
<td>{{merchant}}</td>
<td>{{location}}</td>
<td>{{prettifyDate createdAt}}</td>
<td><button type="button" class="btn btn-danger btn-xs" data-id="{{_id}}"><span class="glyphicon glyphicon-remove-sign"></span></button></td>
</tr>
{{else}}
<h3>You have no active orders</h3>
{{/each}}
</tbody>
</table>
I would like to center the You have no active orders
I've tried class text-center but its not working.

Your H3 element is inside the table so the browser is trying to 'fix it'.
You should wrap your H3 tag in <tr><td colspan="6"><td></tr> tags and then apply class="text-center" to H3

Just add a text-center class on your h3 tag directly, not on it's parent divs like this:
{{else}}
<h3 class="text-center">You have no active orders</h3>
{{/each}}
Here's a jsfiddle with the above codes: http://jsfiddle.net/AndrewL32/65sf2f66/26/

You must try applying vanilla CSS to the above code.
table.table h3 {
text-align:center;
}

Related

HTML Table wrap col data to fit to the view

Have a question about the HTML view related to the table.
In my HTML view, I have a table.
This is worked in a responsive way when changing the view.
Here I want to change the view that the responsive view comes with a scroll bar.
I want to change it to fit all columns to the view and wrap the column contents.
Any suggestions to do it?
<div class="col-md-12 col-sm-12 grid-margin stretch-card">
<div class="card shadow-card-l">
<div class="card-body">
<center><h4 class="card-title">Task Related Documents</h4></center>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Document Type</th>
<th>Document Note</th>
<th>File Name</th>
<th></th>
</tr>
</thead>
<tbody>
#foreach (var item in Model.TaskFilesHistoryViewModel.OrderByDescending(x => x.Id))
{
<tr class="even pointer">
<td>#item.File_Type</td>
<td>#item.Note</td>
<td>#item.File_Name</td>
<td>
<a href="#Url.Action("DownloadTaskImage","Ajax", new { id = item.Id})" target="_blank" rel="publisher tag" class="btn btn-outline-info ti-import" />
<a href="#Url.Action("RetrieveTaskImage","Ajax", new { id = item.Id})" target="_blank" rel="publisher tag" class="btn btn-outline-success fa ti-eye" />
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
</div>

How can I remove the border from this table

The thing is I want to add two anchor elements for every table row so I needed to add two more for those links,
and the problem is that when I add them a border appears at the top of thead even when I set
<th style="display:none;"></th>
here's the table code
.tablesgh table{
width: 80%;
margin:auto;
/* align-self: center; */
}
<div class="tablesgh">
<table style="border-collapse: collapse;" class="table text-center table-responsive table-success table-hover table-bordered table-sm">
<thead>
<tr>
<!-- <div class="boldTd"> -->
<th>Nom complet</th>
<th>Num telephone</th>
<th>Lien du profile</th>
<th>Date ajouté</th>
<th style="display:none;"></th>
<th style="display:none;"></th>
<!-- </div> -->
</tr>
</thead>
{% for client in clients %}
<!-- <script>
var cli_name="{{client.name}}";
var cli_id="{{client.id}}";
</script> -->
<tr>
<td>{{client.name}}</td>
<td>{{client.phone}}</td>
<td>{{client.profile_link}}</td>
<td>{{client.date_added}}</td>
<td style="display:none;">{{client.id}}</td>
<td><a style="position:relative;" href="{% url 'delete-record' client.id %}" class="btn btn-outline-danger">Effacer</a></td>
<td>Afficher les commandes</td>
</tr>
{% endfor %}
</table>
<!-- </div>
</div> -->
</div>
Here's a picture of the table
Your table is of class table-bordered, you can try getting rid of that.
You can also control the border appearance directly from the style attribute: for instance, if you replace display:none; with border: 0px;, it should disappear. You can also make it transparent (border-color: transparent;), etc.

Ngbpopover is not taking the external css that is define in ng-template when container="body" is used in ngbpopover

I want my ngbpopover to appear at the top of the parent element as it is appearing below the parent element. I had put container="body" in ngbpopover that fix the given issue but somehow the external css is not appearing that I had defined in ng-template.
<mat-tab-group animationDuration="0ms">
<div *ngFor="let sampleData of sampleDataInfo[j]; let i=index">
<mat-tab label="{{targetData[j][i].fullName}}">
<table class="source-target-Info-table">
<tr class="source-target-Table">
<th><img data-toggle="tooltip" data-placement="bottom" title="Sub1"></th>
<th>row2</th>
<th>row3</th>
<th>row4</th>
<th>row5</th>
<th>row6</th>
<th>row7</th>
<th>row8</th>
<th>row9</th>
<th>row10</th>
</tr>
<tr *ngFor="let target of targetData[j][i].files; let file=index">
<td>
<a class="info-link" href="javascript:;" title=" Log-{{sampleData?.sessionId}}" (click)="openDexLog(j,i)">
{{(1)}}
</a>
</td>
<td *ngIf="target.qualityLevel > 0; else negativeQuality">
**<a class="info-link" href="javascript:;" title="Click to see Quality result files" href="javascript:;" placement="top-left" popoverClass="popover-class" [ngbPopover]="popContentQuality" container="body">{{target.qualityLevel}}</a>**
</td>
**
<ng-template class="quality-popover" #popContentQuality>**
<h1 class="quality-heading">Quality Results for</h1>
<h3 class="file-name">{{target.name}}</h3>
<table class="source-target-Info-table">
<tr class="source-target-Table">
<th>FILE NAME</th>
<th>SIZE</th>
<th>DESCRIPTION</th>
</tr>
<tr *ngFor="let tq of tqData; let i=index">
<td>
<a class="info-link" href="javascript:;">{{tq.name}}</a>
</td>
<td>{{tq.size/1000}} KB</td>
<td>{{tq.description}}</td>
</tr>
</table>
</ng-template>
</tr>
</table>
</mat-tab>
</div>
</mat-tab-group>
It is only taking the css if is defined in inline format ( using style). Is there any to make the external css working when container="body" for ngbpopover in ng-template? I had also tried to define the external css in the component that consist of body tag but that doesn't work for me. Any suggestions regarding this will be helpful.
Probably styles incapsulated in :host selector. Input container="body" makes you tooltip content not inside host component.

"vertical-align:middle" works as inline style but not in external CSS

This has been bugging me a lot and when I try to google anything related to the subject, all I get is Stack Overflow questions about vertical-align not working on divs or similar elements.
I have this HTML table where as you can see, I set the style of each td to vertical-align:middle through an HTML inline style attribute:
<div ng-hide="getShoppingCart().length===0" class="col-md-10 col-md-offset-1">
<table class="table table-striped">
<tr>
<th class="col-md-2"></th>
<th class="col-md-3">Name</th>
<th class="col-md-2">Size</th>
<th class="col-md-2">Price</th>
<th class="col-md-2">Quantity</th>
<th class="col-md-1"></th>
</tr>
<tr ng-repeat="article in getShoppingCart()" style="height:120px;">
<!-- Image -->
<td class="col-md-2" align="center" style="vertical-align:middle;">
<img ng-src="{{article.media.images[0].smallHdUrl}}" class="img-responsive" style="height:120px;" >
</td>
<!-- Name -->
<td class="col-md-3" style="vertical-align:middle;">
<p>{{ article.name }}</p>
</td>
<!-- Size -->
<td class="col-md-2" style="vertical-align:middle;">
<p>{{ article.unit.size }}</p>
</td>
<!-- Price -->
<td class="col-md-2" style="vertical-align:middle;">
<p>£ {{ getTotalPriceForArticle($index) | number : 2 }}</p>
</td>
<!-- Quantity -->
<td class="col-md-2" style="vertical-align:middle;">
<button class="btn minusButtons" ng-click="decrementQuantity(article, $index)">–</button>
<input type="number" class="form-control" style="position:relative;top:2px;width:4vw;display:inline-block;" ng-model="getQuantities()[$index]"/>
<button class="btn plusButtons" ng-click="incrementQuantity(article, $index)">+</button>
</td>
<td class="col-md-1" align="left" style="vertical-align:middle;">
<button ng-click="removeArticleAtIndex($index)" class="btn redButtons" style="margin-left:0;">
<span class="glyphicon glyphicon-trash"></span>
</button>
</td>
</tr>
</table>
<div class="col-md-12" style="font-size:2vw; text-align:right;">
Total Price: £ {{ getTotalPrice() | number : 2 }}
</div>
So naturally I thought I could remove all of these inline styles and add this global rule in my external CSS file:
td {
vertical-align: middle;
}
But when I do that, the contents of the table's cells stop being aligned to the middle. I'm sure that the CSS file is properly linked as other elements are clearly affected by it. Also I checked the rest of the CSS and there are no other rules with higher priority overriding this property for this table. Any ideas?
Note: As you can probably figure out from the code, I'm using AngularJS and the table rows are being generated using ng-repeat, in case it could have something to do with the problem.
It's due to bootstrap overriding this with a higher specificity. This is what I see in the chrome developer console for td's:
.table>tbody>tr>td {
padding: 8px;
line-height: 1.42857143;
vertical-align: top;
border-top: 1px solid #ddd;
}
I would recommend doing something like the following:
.table.td-vertical-center>tbody>tr>td {
vertical-align: middle;
}
Then in your table element you can do this:
<table class="table table-striped td-vertical-center">
This will allow you to wrap this style in a custom class that will not override bootstrap by default, as well as give it enough specificity to update the table cells.
You can see a working example of a bootply here
Try this
td, th {
vertical-align: middle !important;
}

Links not appearing in ie 8 but they do appear in chrome

I have some regular garden variety links (this is asp.net MVC 2 so the routing might be a little weird) that appear in chrome but not ie 8. How the heck does that happen?
And here the Link does show up in chrome...
The links that I am refering to are the Add Patient and Add Encounter links on the bottom left hand corner of the page.
Here is the garden variety anchor tag that generates the link...
<a class="AddPatDlg" href="/PatientACO/AddPatient?PopID=1" title="Add Patient ACO Data">Add Patient</a>
<a class="AcoData" href="/PatientACO/AddEncounter?PopID=1" title="Add New Patient Encounter">Add Encounter</a>
Am I losing my mind? How on earth is this possible?
* I just noticed that if I scroll up to a place where I can't see the link and scroll back down the links will appear. When I mouse over them, they will disappear... Help*
update 2: more code
<div id="countdownDiv" style="display:none" align="left">
<p><font color="#990000"><b>This session has expired. Please Refresh the page</b> </font></p>
<form action="/PatientACO/TemplateInfo?PopulationID=1&ActiveAll=1" method="post"> <input type="submit" value="Refresh" id="test" /></form></div>
<div id="frReloadDiv" align="right">
<form action="/PatientACO/TemplateInfo?PopulationID=1&ActiveAll=0" method="post">
<input type="submit" value="Show All" id="test1" /></form><form action="/PatientACO/TemplateInfo?PopulationID=1&ActiveAll=1" method="post">
<input type="submit" value="Active Only" id="Submit1" style="display:none"/></form>
</div>
<div id="tempplateInfo">
<div id="templateResult" class="scroll"></div>
<table id="table1" class="scroll" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th>Edit</th>
<th>MRN</th>
<th>Hospital Fin</th>
<th>First Name</th>
<th>Last Name</th>
<th>Date of birth</th>
<th>Completed Pathway</th>
<th>Completed Pathway Reason</th>
<th>PCP Appointment</th>
<th>Specialist Appointment</th>
<th>Admit Date</th>
<th>Discharge Date</th>
<th>Discharge Disposition</th>
<th>Discharge To</th>
<th>Discharge Advocate Call</th>
<th>Home Health Care Accepted</th>
<th>Safe Landing Accepted</th>
<th>PCP Name</th>
<th>PCP Phone</th>
<th>PCP Appointment Location</th>
<th>Specialist Name</th>
<th>Specialist Phone</th>
<th>Specialist Appointment Location</th>
<th>Comments</th>
<th>Patient Room Phone</th>
<th>Phone</th>
<th>Payor</th>
<th>MRN Type</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<a class="AddPatDlg" href="/PatientACO/AddPatient?PopID=1" title="Add Patient ACO Data">Add Patient</a>
<a class="AcoData" href="/PatientACO/AddEncounter?PopID=1" title="Add New Patient Encounter">Add Encounter</a>
<p style="text-align:left">
<b>
</b>
</p>
</div>
Maybe that table align left is throwing me for a loop.
UPDATE: the align left doesn't appear to be doing anything... It seems as though "text-align:right" didn't fix anything
I also noticed that in compatibility mode that issue doesn't appear at all.
Trying wrapping an element around your anchors:
<p class="action">
<a class="AddPatDlg" href="#">Add Patient</a>
<a class="AcoData" href="#">Add Encounter</a>
</p>
Then style the element accordingly:
.action {
clear: both;
display: block;
}