Bootstrap table one column exiled way over to the left - html

I wanted to add an icon with a tooltip to a bootstrap table and wow I have failed miserably. it seems to be aligning the flair way over on the left and I would like it to be closer to the thing that the icon/tooltip refers to.
So if you look at this link:
JSFIDDLE
You should notice that no matter how big the table is, the "CPU" column is pushing the column to the left of it all the way over to the left margin of the table.
(this is an image of what it looks like when font awesome actually works)...The image shows the insane gap between the 'flair' and the CPU description. Does anyone know why it is giving the CPU column such an insane berth?
enter link description here
.product-table {
margin-top: 50px;
th {
color: $dark-gray;
padding: 20px 7px;
i {
color: $green;
font-size: 26px;
}
}
a {
color: $text;
&:hover {
color: $green;
text-decoration: none;
}
}
.product-table-body {
border: 1px solid $lightest-gray;
td {
padding: 15px 7px;
}
tr:nth-child(2n+1) {
background-color: $lightest-gray;
}
}
}
<section>
<h2 class="text-center">Things and Stuff</h2>
<div class="table-responsive">
<table class="w-100 text-center product-table">
<tr>
<th></th>
<th><i class="fal fa-microchip"></i><br>CPU</th>
<th><i class="fal fa-database"></i><br>Storage</th>
<th><i class="fal fa-memory"></i><br>RAM</th>
<th><i class="fal fa-desktop"></i><br>IPs</th>
<th><i class="fal fa-tachometer-alt-fast"></i><br>Bandwidth</th>
<th><i class="fal fa-hand-holding-usd"></i><br>Monthly</th>
<th></th>
</tr>
<tr>
<td>
<span style="color: #6e9c23;">
<i class="fal fa-fire fa-2x" data-toggle="tooltip" data-placement="left" title="Recommended"></i>
</span>
</td>
<td>Xeon E3-1245v5 (4x3.5GHz)</td>
<td>1x1TB</td>
<td>16GB</td>
<td>5</td>
<td>10000GB</td>
<td>$89</td>
<td><div class="d-inline-block"><i class="fas fa-chevron-right"></i></div></td>
</tr>
</table>
</div>
</section>

It looks like your column's width is set at a certain percentage of the table. Since the table takes up a percentage of the screen, the column's size can be different on larger/smaller screens. I'd recommend setting a width value for the table so it's the same size on different screens.
Hope this helps.

Related

Remove white space in table

I have a table and in one of the columns exists two icons.
here is the pic
this is the code:
<td>
<i class="zmdi zmdi-plus-circle-o text-success"></i>
<i class="zmdi zmdi-help zmdi-hc-fw" data-toggle="tooltip" data-placement="top" data-container="body" data-html="true" title="" data-original-title="ADD"></i>
</td>
I need the icons to be in the same line and the same height as the other icons.
So I added display: flex.
And get this result:
And since I need the icons to be in the same line as the other I used:
padding-top: 23px and get this results
The problem is when I hover with the mouse on the line, in this place exists the white or blank space.
The white space starts exactly after I used display flex, and reduces a little after I used padding top.
I do not want this white blank, so when I hover all the line will be blue as before (first pic).
can someone assist
this is my new code:
<td style="display: flex;padding-top: 23px;">
<i class="zmdi zmdi-plus-circle-o text-success"></i>
<i class="zmdi zmdi-help zmdi-hc-fw" data-toggle="tooltip" data-placement="top" data-container="body" data-html="true" title="" data-original-title="ADD"></i>
</td>
this is the computed tab
If I do this in the developer tools it solved, how to do it via code?
Take a look, I have created an example and it works, so you should check CSS code.
If you cannot provide CSS code how can I help?
table {
border: 1px solid red;
width: 50%;
}
<table>
<tr>
<td style="display: flex;">
<i style="width: 25px;height: 25px;border: 1px solid blue;display: unset;"
class="zmdi zmdi-plus-circle-o text-success"></i>
<i style="width: 25px;height: 25px;border: 1px solid blue;display: unset;"
class="zmdi zmdi-help zmdi-hc-fw"
data-toggle="tooltip"
data-placement="top"
data-container="body"
data-html="true" title=""
data-original-title="ADD">
</i>
</td>
</tr>
</table>

Cannot horizontally center two font-awesome icons in container

I've made some research here and tried all i can but those icons don't want to be centered. Don't hurt yourself with those &nbsp, margin doesn't seems to work..
[class^="icon-"], [class*=" icon-"] {
display: inline-block;
width: 100%;
}
td a {
text-align:center;
}
.fa-phone {
color: #86b545;
}
.fa-map-signs{
color: #86b545;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<table>
<tr>
<td><a class="fa fa-phone fa-3x" href="tel:+33500000000"></a>
<a class="fa fa-map-signs fa-3x" href="https://www.google.com/maps/place/Acttif+Littoral/#47.2957248,-2.2068371,15z/data=!4m2!3m1!1s0x0:0x358670f7109ad0d7?ved=2ahUKEwjMl8zni8rgAhULAWMBHftSDJIQ_BIwCnoECAYQCA"></a> </td>
</tr>
</table>
It's best not to use a table layout for this.
<div class="icon-layout">
<a class="fa fa-phone fa-3x" href="tel:+33500000000"></a>
<a class="fa fa-map-signs fa-3x" href="https://www.google.com/maps/place/Acttif+Littoral/#47.2957248,-2.2068371,15z/data=!4m2!3m1!1s0x0:0x358670f7109ad0d7?ved=2ahUKEwjMl8zni8rgAhULAWMBHftSDJIQ_BIwCnoECAYQCA"></a>
</div>
CSS
.icon-layout {
vertical-align: middle;
// if you want icons centered horizontally
text-align: center
}
.icon-layout a {
display: inline-block;
}
.icon-layout a:last-child {
margin-left: 10px;
}
Give that ago
Reformatting markup for readability & adding a new class center to td
<td class="center">
<a class="fa fa-phone fa-3x" href="tel:+33500000000" />
<a
class="fa fa-map-signs fa-3x"
href="https://www.google.com/maps/place/Acttif+Littoral/#47.2957248,-2.2068371,15z/data=!4m2!3m1!1s0x0:0x358670f7109ad0d7?ved=2ahUKEwjMl8zni8rgAhULAWMBHftSDJIQ_BIwCnoECAYQCA"
/>
</td>
You can then do
.center {
display: flex;
justify-content: center;
}

Text-decoration: none using table --having trouble

Although this may seem trivial to most of you, for some I can't get the text-decoration:none apply in a table cell as shown in the below.
What am I doing wrong with my css?
Any inputs will be greatly appreciated
table{
font-size: 50px;
}
table a{
text-decoration: none;
}
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css" rel="stylesheet"/>
<div>
<table>
<tbody>
<tr>
<td>
<i class="fa fa-quote-left" aria-hidden="true"></i>
<p>Quote Master</p>
</td>
</tr>
</tbody>
</table>
</div>
If you want the black color, apply color: inherit to the anchor tag.
Generally the color of the anchor tag is 'purple'(#0000EE;), if you see any where,
Eg: google search results all links consists purple color links.
If we apply color: 'inherit', the parent's color will be applied to the anchor overriding the default color, if it also not black, you can explicitly declare color: 'black' to that anchor.
table{
font-size: 50px;
}
table a{
text-decoration: none;
color: inherit
}
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css" rel="stylesheet"/>
<div>
<table>
<tbody>
<tr>
<td>
<i class="fa fa-quote-left" aria-hidden="true"></i>
<p>Quote Master</p>
</td>
</tr>
</tbody>
</table>
</div>

Force Bootstrap 3 table header to fixed widths

I need to fix the width of the header columns in my Bootstrap 3 table, regardless of the content in the regular rows. This is to avoid content being separated onto two lines as you can see below, which looks awfully untidy:
Is there any way to do this, preferably without toying with the padding for every table row as I'm happy with the current spacing. You can see the full table at http://find-minecraft-servers.com/, and I've included the HTML, and custom CSS associated with the table below. The content for the table is generated by PHP, so the length of the values in each table cell is subject to change.
<table class="table bigtable" width="100%;">
<thead>
<tr>
<th class="text-center"><i class="fa fa-list-ol"></i> RANK</th>
<th class="text-center"><i class="fa fa-info-circle"></i> NAME</th>
<th class="text-center"><i class="fa fa-server"></i> SERVER</th>
<th class="text-center">
<a href="?sort=votes" style="text-decoration:none;color:#fff;">
<i class="fa fa-thumbs-o-up"></i> VOTES <i class="fa fa-sort" style="color:#84fb88;"></i>
</a>
</th>
<th class="text-center"><i class="fa fa-dashboard"></i> STATUS</th>
<th class="text-center">
<a href="?sort=players" style="text-decoration:none;color:#fff;">
<i class="fa fa-users"></i> PLAYERS <i class="fa fa-sort" style="color:#84fb88;"></i>
</a>
</th>
</tr>
</thead>
<tbody>
CONTENT...
</tbody>
</table>
Custom.css:
.bigtable thead {
background-color: #12bbb9;
color: #fff;
font-size: 14px;
}
.bigtable thead tr th {
padding:8px 5px 8px 5px;
}
Add table-layout:fixed to the table, then give width to the th containing the large image.
.table {
margin-bottom: 20px;
max-width: 100%;
table-layout: fixed; /*newly added*/
width: 100%;
}

jQuery treetable text aligned to icon - span.indenter

I have a treetable which columns have an icon and text like this (this is fine)*:
However, when I reduce the width of the screen, this happens:
And I would like to have something like this:
My html is like this:
<tr data-tt-id="2" data-tt-parent-id="1">
<td>
<i class="fa fa-lg fa-file-text-o"></i>
Title
</td>
</tr>
And my js is:
$("#requestForQuotationTable").treetable({
expandable: true,
indent: 15
});
And the code generated by treetable is this:
<tr data-tt-id="2" data-tt-parent-id="1">
<td>
<span class="indenter" style="padding-left: 15px;"></span>
<i class="fa fa-lg fa-file-text-o"></i>
Title
</td>
</tr>
I have tried setting pull-left in the icon as suggested in here, but then it ignores the span.indenter element, getting the icon to the left.
I have also tried this, with no good results either because of the span.indenter.
All what I have tried leads me to think that my problem is with the span.indenter, but I can't figure out a way to solve this.
Edit after Jayababu's response:
<td>
<span class="indenter" style="padding-left: 30px;float: left;"></span>
<span style="float:left">
<i class="fa fa-lg fa-file-text-o" style="vertical-align: middle;"></i>
</span>
<span style="float:left"><a href="javascript:void(0)" style="cursor: pointer;">
hgjkghjk ghjk ghjk ghjk hgjk hgjkghjk</a>
</span>
</td>
looks like this (it's still ignoring the indenter and the text is not looking good =():
*I have created these images from the example in http://ludo.cubicphuse.nl/jquery-treetable/#usage
In the page you have mentioned,the folder image is loading as a background image
for the span.
If you need a design like you have shown in the third screen shot.
Restructuring is the only one solution in your case.
Ideally you need to create 2 elements let it be 2 spans one to hold the image,another to hold the text.Align both the spans with float:left.
Please find the below code snipped,working fine as you need
As we cant display images in the code snippet,i have just colored the indenter and folder icon with red and green.
.folder{
float: left;
background: green;
width: 20px;
height: 20px;
display: inline;
}
.indenter> a{
background: red;
width: 19px;
}
.indenter{
padding-left: 30px;
float: left;
display: inline;
}
.content{
display: inline;
height: auto;
}
<table>
<tbody><tr class="branch ui-droppable expanded selected" data-tt-id="3-1" data-tt-parent-id="3" style="display: table-row;">
<td>
<span class="indenter" > </span>
<span class="folder" >
<i class="fa fa-lg fa-file-text-o" style="vertical-align: middle;"></i>
</span>
<span class="content" ><a href="javascript:void(0)" style="cursor: pointer;">
hgjkghjk ghjk ghjk ghjk hgjk hgjkghjkhgjkghjk ghjk ghjk ghjk hgjk hgjkghjk</a>
</span>
</td>
</tr>
</tbody></table>