How can I remove the border from this table - html

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.

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>

HTML table isn't responding to overflow=scroll or any height changes

I have the following html (excuse the weird indentation). The part in question (for now) is the very last table (the one whos body has id="allErrorsTable"). I am trying to get it so that the table body will scroll instead of extending off of the screen when its contents grows too large.
<div class="tab-content noPadding" style="height: 100%">
<div class="tab-pane active" id="dataTab"> ... </div>
<div class="tab-pane" id="errorTab">
<h5>Current Precinct:</h5>
<table class="table table-hover scrollable">
<thead>
<th onclick="sortTable("current", "precinct")">Precinct:</th>
<th onclick="sortTable("current", "type")">Error Type:</th>
<th>Resolve Error</th>
</thead>
<tbody id="currentErrorsTable"></tbody>
</table>
<h5>All Errors:</h5>
<table class="table table-hover table-sm">
<thead>
<th onclick="sortErrorTable("all", "precinct")">Precinct:</th>
<th onclick="sortErrorTable("all", "type")">Error Type:</th>
<th>Resolve Error</th>
</thead>
<tbody id="allErrorsTable" class="scrollable" style="height: 10px"></tbody>
</table>
</div>
I know that all of the heights of the parents from the top level (tab-content) div and up are fine because I have a seperate table in the "dataTab" div with the same scrolling feature working just fine. To be explicit though, the 100% in the top level div here derives from a parent div with height="100vh", so definitely an absolute height.
I know it's an issue of the height not being absolute for the table for some reason but I gave it a height of 10px just for testing and it still doesn't resize. Can someone help me figure out where I need to explicitly declare heights for this? I need them to be relative heights in the end but getting it to resize/scroll at all is the first priority.
th {
border-style: solid;
}
<div class="tab-content noPadding" style="height: 100%; width: 100%; overflow: scroll;">
<div class="tab-pane active" id="dataTab"> ... </div>
<div class="tab-pane" id="errorTab">
<h5>Current Precinct: a;lkjsdf;lakjdsf;lkasjfds;lkfjdsaf;lkdsjfds;lfakj</h5>
<table class="table table-hover scrollable">
<thead>
<th onclick="sortTable("current", "precinct")">Precinct: fskl;ads;lkfjdsf;lskfjds;lfajdsfj;lksf</th>
<th onclick="sortTable("current", "type")">Error Type:jfkal;dsljfla;jflkdsjflkdsjflkdsjflka</th>
<th>Resolve Errorlja;jdsfl;ksajflkdsjflkdsjfl</th>
</thead>
<tbody id="currentErrorsTable"></tbody>
</table>
<h5>All Errors:</h5>
<table class="table table-hover table-sm">
<thead>
<th onclick="sortErrorTable("all", "precinct")">Precinct:</th>
<th onclick="sortErrorTable("all", "type")">Error Type:</th>
<th>Resolve Error</th>
</thead>
<tbody id="allErrorsTable" class="scrollable" style="height: 10px"></tbody>
</table>
</div>

Bootstrap fixed table header not hiding form/button glyphicon

I have a table with a fixed header, and in one of the columns there are delete buttons within a form:
<div class="panel panel-default table-responsive fixedHeader">
<!-- Table -->
<table class="table table-striped">
<thead>
<tr>
<!--table headers are here-->
</tr>
</thead>
<tbody>
{% for row in hoursDb %}
<tr>
<!-- all rows are called here, just saving space -->
<td>
<form action="" method="post">
<button type="submit" class="btn btn-default" name="delete" value="{{ row[7] }}">
<span class="glyphicon glyphicon-remove"></span>
</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
I used the following css to get a fixed header:
.fixedHeader {
height:40vh;
overflow-y:auto;
}
.fixedHeader th {
position: sticky;
top: 0;
}
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 16px; }
th { background:#eee; }
The other row data are hidden by the header when scrolled, but the problem is that when I scroll within the table, the remove glyphicon is still showing and I am able to click on the button which deletes the row.
How would I change it so the table header covers the form/button/glyphicon?
Thanks in advance for any answers.
Have you tried using Z-index? Share snapshot if possible.

"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;
}

Bootstrap: center <h3> underneath table

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;
}