I was creating a table and suddenly this white space showed up between rows. I tried some things but couldn't get it to go away.
Later realised that it happened only when bootstrap was enabled
When I remove bootstrap css file it gets fixed.
Here is without bootstrap
body {
margin: 0;
background-image: url(https://ambrosia-servers.com/adminactivity/images/background.jpg);
background-repeat: no-repeat;
background-size: cover;
top: 0px;
}
.table th h1 {
font-weight: bold;
font-size: 1em;
text-align: center;
color: #C6B642;
padding: 5px;
}
.table td {
font-weight: bold;
font-size: 1em;
color: #8e8e8e;
padding: 10px;
}
.table {
text-align: left;
overflow: hidden;
width: 100%;
display: table;
border-collapse: collapse;
/*padding: 0 0 8em 0;*/
}
.table td,
.table th {
padding:0;
margin:0;
}
.table tr:nth-child(odd) {
background-color: #252424;
}
.table tr:nth-child(even) {
background-color: #000000;
border: black 0px solid;
}
.table th {
background-color: #2B2B1B;
}
.table td:first-child {
background-color: #2b2b1b;
color: #C6B642;
font-weight: bold;
}
.table tr:hover {
background-color: #464A52;
}
.table td:hover {
background-color: #C6B642;
color: #403E10;
font-weight: bold;
transition-delay: 0s;
transition-duration: 0.15s;
transition-property: all;
}
#media (max-width: 800px) {
.table td:nth-child(4),
.table th:nth-child(4) {
display: none;
}
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/1000hz-bootstrap-validator/0.11.9/validator.min.js"></script>
<table class="table">
<thead>
<tr>
<th><h1>Sites</h1></th>
<th><h1>Views</h1></th>
<th><h1>Clicks</h1></th>
<th><h1>Average</h1></th>
</tr>
</thead>
<tbody>
<tr>
<td>Google</td>
<td>9518</td>
<td>6369</td>
<td>01:32:50</td>
</tr>
<tr>
<td>Twitter</td>
<td>7326</td>
<td>10437</td>
<td>00:51:22</td>
</tr>
<tr>
<td>Amazon</td>
<td>4162</td>
<td>5327</td>
<td>00:24:34</td>
</tr>
<tr>
<td>LinkedIn</td>
<td>3654</td>
<td>2961</td>
<td>00:12:10</td>
</tr>
<tr>
<td>CodePen</td>
<td>2002</td>
<td>4135</td>
<td>00:46:19</td>
</tr>
<tr>
<td>GitHub</td>
<td>4623</td>
<td>3486</td>
<td>00:31:52</td>
</tr>
</tbody>
Bootstrap enabled
body {
margin: 0;
background-image: url(https://ambrosia-servers.com/adminactivity/images/background.jpg);
background-repeat: no-repeat;
background-size: cover;
top: 0px;
}
.table th h1 {
font-weight: bold;
font-size: 1em;
text-align: center;
color: #C6B642;
padding: 5px;
}
.table td {
font-weight: bold;
font-size: 1em;
color: #8e8e8e;
padding: 10px;
}
.table {
text-align: left;
overflow: hidden;
width: 100%;
display: table;
border-collapse: collapse;
/*padding: 0 0 8em 0;*/
}
.table td,
.table th {
padding:0;
margin:0;
}
.table tr:nth-child(odd) {
background-color: #252424;
}
.table tr:nth-child(even) {
background-color: #000000;
border: black 0px solid;
}
.table th {
background-color: #2B2B1B;
}
.table td:first-child {
background-color: #2b2b1b;
color: #C6B642;
font-weight: bold;
}
.table tr:hover {
background-color: #464A52;
}
.table td:hover {
background-color: #C6B642;
color: #403E10;
font-weight: bold;
transition-delay: 0s;
transition-duration: 0.15s;
transition-property: all;
}
#media (max-width: 800px) {
.table td:nth-child(4),
.table th:nth-child(4) {
display: none;
}
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/1000hz-bootstrap-validator/0.11.9/validator.min.js"></script>
<table class="table">
<thead>
<tr>
<th><h1>Sites</h1></th>
<th><h1>Views</h1></th>
<th><h1>Clicks</h1></th>
<th><h1>Average</h1></th>
</tr>
</thead>
<tbody>
<tr>
<td>Google</td>
<td>9518</td>
<td>6369</td>
<td>01:32:50</td>
</tr>
<tr>
<td>Twitter</td>
<td>7326</td>
<td>10437</td>
<td>00:51:22</td>
</tr>
<tr>
<td>Amazon</td>
<td>4162</td>
<td>5327</td>
<td>00:24:34</td>
</tr>
<tr>
<td>LinkedIn</td>
<td>3654</td>
<td>2961</td>
<td>00:12:10</td>
</tr>
<tr>
<td>CodePen</td>
<td>2002</td>
<td>4135</td>
<td>00:46:19</td>
</tr>
<tr>
<td>GitHub</td>
<td>4623</td>
<td>3486</td>
<td>00:31:52</td>
</tr>
</tbody>
</table>
Try adding this to your css - you already have the classes set. you just need to add the border-top to that section.
.table td, .table th {
border: none !important;
}
You can use:
.table > tbody > tr > td {
border-top: none;
}
Of course, it'll only works if your CSS is executed after the Bootstrap import. Otherwise, you'll need a border-top: none !important to force the override.
Related
I'm building a very basic test website in HTML, and I'm learning how to put borders on table cells. I have a problem, I'm trying to round the borders in my table but I just get rounded cells (td and th), but not the table itself.
table,
th,
td {
text-align: center;
width: 30%;
border: 5px solid aqua;
border-collapse: collapse;
border-radius: 45px;
font-family: arial;
padding: 11px;
}
th {
color: white;
font-family: impact;
}
td {
color: yellow;
}
tr:nth-child(odd) {
background-color: darkblue;
}
<table align=c enter>
<tr>
<th>Choncho</th>
<th>Klokin</th>
<th>Fetuc</th>
</tr>
<tr>
<td>100</td>
<td>200</td>
<td>300</td>
</tr>
<tr>
<td>papas</td>
<td>refrescos</td>
<td>tingas</td>
</tr>
</table>
I even tried doing the following to see if there were any changes:
table {
border-radius: 45px;
}
the,
td {
text-align: center;
width: 30%;
border: 5px solid aqua;
font-family: arial;
padding: 11px;
}
But all the borders remain squares.
I think that has something to do with collapsing the border.
Try to remove this line
border-collapse: collapse;
table,
th,
td {
text-align: center;
width: 30%;
border: 5px solid aqua;
/* border-collapse: collapse; *//* remove this line */
border-radius: 45px;
font-family: arial;
padding: 11px;
}
th {
color: white;
font-family: impact;
}
td {
color: yellow;
}
tr:nth-child(odd) {
background-color: darkblue;
}
<table align=c enter>
<tr>
<th>Choncho</th>
<th>Klokin</th>
<th>Fetuc</th>
</tr>
<tr>
<td>100</td>
<td>200</td>
<td>300</td>
</tr>
<tr>
<td>papas</td>
<td>refrescos</td>
<td>tingas</td>
</tr>
</table>
Then use padding and margin to control the spacing if needed
I have an HTML document with a stylesheet referenced in a link tag. The character set is UTF-8 and is defined in the HTML and CSS files. In Chrome and Microsoft Edge, the CSS renders as it should, however in Firefox and IE it doesn't load it. There aren't any errors in the Console of Developer tools and no compilation errors in the IDE I am using.
I can go directly to the CSS file using the absolute file path in the URL bar and it will display the contents of the file, and it will render the HTML just fine. The CSS will render when I enclose it in style tags in the HTML file itself. However, I want to link tag it for organization.
I cannot find the solution anywhere even though many people have had this issue. I'm wondering if there is a known solution to this that could help me.
Here is the HTML:
<!DOCTYPE html>
<html>
<head>
<title>#</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="\css\core-test.css" media="screen">
</head>
<body>
<div class="container">
<nav class="navbar">
<a>#</a>
</nav>
<div class="table-box">
<div class="table-body">
<table id="main-table" class="table">
<thead>
<tr>
<th>TIME</th>
<th>TICKER</th>
<th>CALL/PUT</th>
<th>EXPIRY</th>
<th>STRIKE</th>
<th>SPOT</th>
<th>PRICE</th>
<th>SIZE</th>
<th>TOTAL</th>
<th>OI</th>
<th>IV</th>
<th><button id="filterbtn" class="filterbtn fa fa-filter"></button></th>
</tr>
</thead>
<tbody>
<tr>
<td>00:12:34</td>
<td class="btc-color">BTC</td>
<td class="put-color">PUT</td>
<td>4/28</td>
<td>$7800</td>
<td>$7219</td>
<td>₿0.031</td>
<td>20</td>
<td class="put-color">₿62</td>
<td>1120</td>
<td>60.9%</td>
<td><button class="chartbtn fa fa-line-chart"></button></td>
</tr>
<tr>
<td>00:12:34</td>
<td class="btc-color">BTC</td>
<td class="put-color">PUT</td>
<td>4/28</td>
<td>$7800</td>
<td>$7219</td>
<td>₿0.031</td>
<td>20</td>
<td class="put-color">₿62</td>
<td>1120</td>
<td>60.9%</td>
<td><button class="chartbtn fa fa-line-chart"></button></td>
</tr>
</tbody>
</table>
<div id="option-modal" class="option-modal">
<div id="option-modal-box" class="option-modal-box">
<span id="closebtn" class="closebtn">×</span>
<div id="option-modal-header" class="option-modal-header">
<a id="option-modal-header-title" class="btc-color option-modal-header-title">BITCOIN</a>
</div>
<div id="option-modal-body" class="option-modal-body">
<div id="chart-box" class="chart-box">
<div class="box-header">
<a class="box-title">Chart</a>
</div>
<div style="background-color: gray;" class="box-body">
<a>chart-box</a>
</div>
</div>
<div id="orderbook-box" class="orderbook-box">
<div class="box-header">
<a class="box-title">Orderbook</a>
</div>
<div class="box-body">
<div class="orderbook-bid-body">
<table id="orderbook-bid-table" class="orderbook-bid-table">
<thead>
<tr>
<th>TOTAL</th>
<th>SIZE</th>
<th>BID</th>
</tr>
<tbody>
<tr>
<td>1.0</td>
<td>1.0</td>
<td class="call-color">0.031</td>
</tr>
<tr>
<td>1.0</td>
<td>1.0</td>
<td class="call-color">0.031</td>
</tr>
</tbody>
</thead>
</table>
</div>
<div class="orderbook-ask-body">
<table class="orderbook-ask-table">
<thead>
<tr>
<th>ASK</th>
<th>SIZE</th>
<th>TOTAL</th>
</tr>
</thead>
<tbody>
<tr>
<td class="put-color">0.032</td>
<td>1.0</td>
<td>1.0</td>
</tr>
<tr>
<td class="put-color">0.032</td>
<td>1.0</td>
<td>1.0</td>
</tr>
</table>
</div>
</div>
</div>
<div id="stat-box" class="stat-box">
<div class="box-header">
<a class="box-title">Greeks</a>
</div>
<div class="box-body">
<table id="greek-table" class="option-modal-table">
<thead>
<tr>
<th>MARK</th>
<th>OI</th>
<th>IV</th>
<th>DELTA</th>
<th>THETA</th>
<th>VEGA</th>
<th>GAMMA</th>
</tr>
</thead>
<tbody>
<tr>
<td id="mark-greek">0.031</td>
<td id="oi-greek">1120.0</td>
<td id="iv-greek">60.9%</td>
<td id="delta-greek">-0.2</td>
<td id="thelta-greek">-9.0</td>
<td id="vega-greek">1.23</td>
<td id="gamma-greek">0.00012</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="trade-box" class="trade-box">
<div class="box-header">
<a class="box-title">Recent Trades</a>
</div>
<div class="box-body">
<table id="trade-table" class="option-modal-table">
<thead>
<tr>
<th>PRICE</th>
<th>IV</th>
<th>SIZE</th>
<th>TIME</th>
</tr>
</thead>
<tbody>
<tr>
<td>0.032</td>
<td>60.9%</td>
<td>1</td>
<td class="call-color">00:12:34</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
<script>
var optionModal = document.getElementById("option-modal");
var chartButton = document.getElementsByClassName("chartbtn");
var closeButton = document.getElementById("closebtn");
function openChart() {
optionModal.style.display = "block";
}
for (var i = 0; i < chartButton.length; i++) {
chartButton[i].addEventListener("click", openChart);
}
window.onclick = function(event) {
if (event.target == optionModal) {
optionModal.style.display = "none";
}
}
closeButton.onclick = function(event) {
if (event.target == closeButton) {
optionModal.style.display = "none";
}
}
</script>
</html>
Here is the CSS:
#import url(https://fonts.googleapis.com/css2?family=Overpass&display=swap);
#import url(https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css);
#charset "utf-8";
:root {
--bg: #060c17;
--item-bg: #0c1427;
--main-font-color: white;
--border: #262f43;
--th-bg: black;
--th-font: #7886a1;
--btc: #ff8133;
--eth: #106fb7;
--call: #10b759;
--put: #ff3366;
--main-font: 'Overpass', sans-serif;
}
.container {
display: flex;
flex-direction: column;
position: absolute;
align-items: center;
justify-content: center;
top: 0;
right: 0;
left: 0;
bottom: 0;
margin: 0;
background-color: var(--bg);
}
.navbar {
position: fixed;
padding: 20px;
top: 0;
right: 0;
left: 0;
width: 100%;
text-align: center;
background: var(--item-bg);
border-bottom: 1px solid var(--border);
}
.navbar a {
color: var(--main-font-color);
font-size: 20px;
font-family: var(--main-font);
}
.table-box {
display: flex;
border-radius: 0.25rem;
margin-top: 75px;
margin-bottom: 1px;
height: 100%;
width: 99%;
background-color: var(--item-bg);
border: 1px solid var(--border);
overflow: hidden;
}
.filterbtn {
color: var(--th-font);
background-color: var(--th-bg);
font-size: 14px;
border: none;
cursor: pointer;
}
.table-body {
position: relative;
margin-top: 40px;
width: 100%;
overflow: auto;
border-top: 1px solid var(--border);
}
.table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
font-family: var(--main-font);
}
.table thead {
color: var(--th-font);
}
.table tbody {
color: var(--main-font-color);
}
.table thead th {
position: sticky;
top: 0;
background-color: var(--th-bg);
}
.chartbtn {
font-size: 14px;
border: none;
border-radius: 0.25rem;
cursor: pointer;
color: var(--th-font);
background-color: var(--th-bg);
}
.table thead th,
.table tbody td {
text-align: left;
padding: 10px 10px;
border-bottom: 1px solid var(--border);
}
.table tbody tr:nth-child(even) {
background-color: var(--bg);
}
.btc-color {
color: var(--btc);
}
.eth-color {
color: var(--eth);
}
.call-color {
color: var(--call);
}
.put-color {
color: var(--put);
}
.option-modal {
display: block;
position: fixed;
z-index: 1;
padding-top: 20px;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: hidden;
background-color: rgb(0, 0, 0);
background-color: rgba(0, 0, 0, 0.4);
}
.option-modal-box {
display: flex;
margin: auto;
height: 95%;
width: 90%;
background-color: var(--item-bg);
border: 1px solid var(--border);
border-radius: 0.25rem;
overflow: hidden;
}
.closebtn {
padding-top: 0.5%;
right: 6%;
cursor: pointer;
font-size: 20px;
font-family: var(--main-font);
position: fixed;
color: var(--main-font-color);
}
.option-modal-header {
position: fixed;
margin: 5px;
}
.option-modal-header-title {
position: sticky;
font-family: var(--main-font);
font-size: 20px;
}
.option-modal-body {
display: flex;
flex-direction: row;
justify-content: space-evenly;
flex-wrap: wrap;
margin-top: 40px;
height: 90%;
width: 100%;
background-color: var(--item-bg);
overflow: auto;
}
.option-modal-body div {
min-width: 50%;
}
.orderbook-bid-body {
display: inline-table;
}
.orderbook-bid-table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
font-family: var(--main-font);
}
.orderbook-bid-table thead {
color: var(--th-font);
}
.orderbook-bid-table tbody {
color: var(--main-font-color);
}
.orderbook-bid-table thead th {
position: sticky;
top: 0;
background-color: var(--th-bg);
}
.orderbook-bid-table thead th,
.orderbook-bid-table tbody td {
text-align: center;
padding: 5px 0px;
border-bottom: 1px solid var(--border);
border-right: 1px solid var(--border);
border-collapse: collapse;
}
.orderbook-bid-table tbody tr:nth-child(even) {
background-color: var(--bg);
}
.orderbook-ask-body {
float: right;
}
.orderbook-ask-table {
position: relative;
padding-bottom: 10px;
width: 100%;
border-collapse: collapse;
font-size: 14px;
font-family: var(--main-font);
}
.orderbook-ask-table thead {
color: var(--th-font);
}
.orderbook-ask-table tbody {
color: var(--main-font-color);
}
.orderbook-ask-table thead th {
position: sticky;
top: 0;
background-color: var(--th-bg);
}
.orderbook-ask-table thead th,
.orderbook-ask-table tbody td {
text-align: center;
padding: 5px 0px;
border-bottom: 1px solid var(--border);
border-right: 1px solid var(--border);
border-left: 1px solid var(--border);
}
.orderbook-ask-table tbody tr:nth-child(even) {
background-color: var(--bg);
}
.option-modal-table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
font-family: var(--main-font);
}
.option-modal-table thead {
color: var(--th-font);
}
.option-modal-table tbody {
color: var(--main-font-color);
}
.option-modal-table thead th {
position: sticky;
top: 0;
background-color: var(--th-bg);
}
.option-modal-table thead th,
.option-modal-table tbody td {
text-align: center;
padding: 5px 0px;
border-bottom: 1px solid var(--border);
}
.option-modal-table tbody tr:nth-child(even) {
background-color: var(--bg);
}
#media screen and (max-width: 800px) {
.chart-box {
width: 100%;
}
.orderbook-box {
width: 100%;
}
.stat-box {
order: 4;
width: 100%;
}
.trade-box {
width: 100%;
order: 3;
}
}
.chart-box {
height: 50%;
overflow: hidden;
}
.orderbook-box {
height: 50%;
overflow: hidden;
}
.stat-box {
height: 49%;
overflow: hidden;
}
.trade-box {
height: 49%;
overflow: hidden;
}
.box-header {
height: 6%;
padding: 5px;
}
.box-title {
color: var(--main-font-color);
font-family: var(--main-font);
font-size: 16px;
margin: auto;
}
.box-body {
border: 1px solid var(--border);
height: 89%;
overflow: auto;
}
Could the backslashes be the problem?
<link rel="stylesheet" type="text/css" href="/css/core-test.css" media="screen">
Try changing them to forward slashes.
I've got a table that I'm trying to style. I wanted to have a bottom-border underneath the thead and each tr but no matter what I put, it just won't apply. I even tried setting a color for the thead but that wouldn't give either. Any ideas what I'm doing wrong?
.border-bottom {
border-collapse: collapse;
border-bottom: 2px solid #CCD5DE;
}
table {
width: 100%;
max-height: 500px;
overflow: scroll;
}
thead {
color: red;
}
th {
font-weight: 700;
font-size: 20px;
letter-spacing: 1px;
text-align: left;
padding-top: 20px;
padding-bottom: 20px;
}
td {
font-weight: 400;
font-size: 18px;
letter-spacing: .75px;
text-align: left;
padding-top: 20px;
padding-bottom: 20px;
}
<div class="spaced-div">
<table>
<thead class="bottom-border">
<tr>
<th>Date</th>
<th>Stock</th>
<th>Quantity</th>
<th>Price</th>
<th>Fees</th>
<th>Subtotal</th>
</tr>
</thead>
<tbody>
<tr class="border-bottom">
<td>March 21, 2020</td>
<td>DMC</td>
<td>1,330</td>
<td>5.71</td>
<td>23.54</td>
<td>7,617.84</td>
</tr>
</tbody>
</table>
</div>
There are two major issues here,
1) Css property border-collapse: collapse; should be under table element like,
table {
width: 100%;
max-height: 500px;
overflow: scroll;
border-collapse: collapse;
}
2) Make sure you are having the same class name .border-bottom for both thead and tbody tr .
.border-bottom {
border-bottom: 2px solid #CCD5DE;
}
table {
width: 100%;
max-height: 500px;
overflow: scroll;
border-collapse: collapse;
}
thead {
color: red;
}
th {
font-weight: 700;
font-size: 20px;
letter-spacing: 1px;
text-align: left;
padding-top: 20px;
padding-bottom: 20px;
}
td {
font-weight: 400;
font-size: 18px;
letter-spacing: .75px;
text-align: left;
padding-top: 20px;
padding-bottom: 20px;
}
<div class="spaced-div">
<table>
<thead>
<tr class="border-bottom">
<th>Date</th>
<th>Stock</th>
<th>Quantity</th>
<th>Price</th>
<th>Fees</th>
<th>Subtotal</th>
</tr>
</thead>
<tbody>
<tr class="border-bottom">
<td>March 21, 2020</td>
<td>DMC</td>
<td>1,330</td>
<td>5.71</td>
<td>23.54</td>
<td>7,617.84</td>
</tr>
</tbody>
</table>
</div>
The Table with bad text-alignment
In the Picture u see the table with bad text-alignment. The elements of tbody don't fit to those of thead. It's important that the head of the table is fixed, so you can see it even when you scroll down.
The classes i am using for this table are table-hover and my own class "table_Bookingsystem" which propertys are listed below
.table_Bookingsystem{
table-layout: fixed;
border-collapse: collapse;
width: 100%;
margin-left: auto;
margin-right: auto;
text-align: left;
padding-top: 16px;
padding-bottom: 16px;
border: 1px solid #ccc !important;
}
.table_Bookingsystem tbody{
display:block;
width: 100%;
overflow: auto;
}
.table_Bookingsystem thead tr {
display: block;
}
.table_Bookingsystem tr{
border-bottom: 1px solid #ddd;
}
.table_Bookingsystem thead {
background: black;
color:#fff;
}
.table_Bookingsystem th, .table_Bookingsystem td {
padding: 5px;
text-align: center;
width: 5000px; //important line
}
.table_Bookingsystem tbody tr:nth-child(even) {
background-color: #e4ebf2;
color: #000;
}
<table class="table_Bookingsystem table-hover ">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Auto</th>
<th scope="col">IMEI</th>
<th scope="col">Heimatstadt</th>
<th scope="col">derzeitige Stadt</th>
</tr>
</thead>
<tbody #if(count($cars) > 9) style="height: 300px;" #endif>
#foreach($cars as $car)
<tr class="table-row clickable-row" data-href='/cars/{{$car->id}}'>
<th>{{$loop->iteration}}</th>
<td>{{$car->name}}</td>
<td>{{$car->IMEI}}</td>
<td>
<?php
$city = Illuminate\Support\Facades\DB::table('cities')->where('id','=', $car->id_homeCity)->get('name');
echo $city[0]->name; ?>
</td>
<td>
<?php
$city = Illuminate\Support\Facades\DB::table('cities')->where('id','=', $car->id_currentCity)->get();
echo $city[0]->name; ?>
</td>
</tr>
#endforeach
</tbody>
</table>
When i set the width to 250px it looks a little better but then there is a big edge when i have only 4 or less columns. Is there any way to keep the fixed header and put every -element of directly under the corresponding -element of ?
I write a basic table like you share in screenshot. You have added some extra CSS that's why your table ui disturb.
Step 1 - Remove below CSS, we don't need to block table row.
.table_Bookingsystem thead tr {
display: block;
}
Step 2 - Remove display: block; from table_Bookingsystem tbody
.table_Bookingsystem tbody{
width: 100%;
overflow: auto;
}
Step 3 - I just remove width: 5000px; from .table_Bookingsystem th, .table_Bookingsystem td, if you want apply width: 5000px; on each td/th, revert it.
All Mentioned are applied on below code snippet. Try it I hope it'll help you out. Thanks
.table_Bookingsystem th, .table_Bookingsystem td {
padding: 5px;
text-align: center;
}
.table_Bookingsystem{
table-layout: fixed;
border-collapse: collapse;
width: 100%;
margin-left: auto;
margin-right: auto;
text-align: left;
padding-top: 16px;
padding-bottom: 16px;
border: 1px solid #ccc !important;
}
.table_Bookingsystem tbody{
width: 100%;
overflow: auto;
}
.table_Bookingsystem tr{
border-bottom: 1px solid #ddd;
}
.table_Bookingsystem thead {
background: black;
color:#fff;
}
.table_Bookingsystem th, .table_Bookingsystem td {
padding: 5px;
text-align: center;
}
.table_Bookingsystem tbody tr:nth-child(even) {
background-color: #e4ebf2;
color: #000;
}
<table class="table_Bookingsystem">
<thead>
<tr>
<th>#</th>
<th>Auto</th>
<th>IMEI</th>
<th>Heimatstadt</th>
<th>derzeitige Stadt</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Auto</td>
<td>0001</td>
<td>Regensburg</td>
<td>Regensburg</td>
</tr>
<tr>
<td>1</td>
<td>Auto</td>
<td>0001</td>
<td>Regensburg</td>
<td>Regensburg</td>
</tr>
</tbody>
</table>
Try adding text-align: center; to the .table_Bookingsystem tbody rule as it's on the .table_Bookingsystem td rule.
I've been experimenting with advanced selectors and it has been going great until now. I'm trying to align 2 carets below each other in a table. To make it appear like the rows are sortable. But I haven't been able to get it working and I couldn't find any information on this specific issue on google.
If anybody can help me with this or provide information, I'd appreciate it.
HTML:
<div id="table">
<table>
<tr>
<td>Column1</td>
<td>Column2</td>
<td>Column3</td>
<td>Column4</td>
<td>Column5</td>
<td>Column6</td>
<td>Column7</td>
<td>Column8</td>
<td>Column9</td>
<td>Column10</td>
<td></td>
</tr>
</table>
</div>
CSS:
#table tr:first-child td:not(:nth-child(9)):not(:last-child):after {
font-family: FontAwesome;
content: "\f0d7" ' ' "\f0d8";
float:right;
}
JSFIDDLE
http://jsfiddle.net/jk62x5ox/
#table table {
margin-top: 40px;
width: 100%;
border: none;
border-collapse: collapse;
}
#table td {
padding: 0 5px;
border-left: 1px solid #000;
border-right: 1px solid #000;
}
#table tr {
background: #dbe5f1;
}
#table td:first-child {
border-left: none;
}
#table td:last-child {
border-right: none;
padding-right: 0;
}
#table tr td:last-child:before {
font-family: FontAwesome;
content: "\f05c";
font-size: 18px;
}
#table tr:first-child td:not(:nth-child(9)):not(:last-child):after {
font-family: FontAwesome;
content: "\f0d8"' '"\f0d7";
float: right;
width: 5px;
line-height: 0.5;
}
<div id="table">
<table>
<tr>
<td>Column1</td>
<td>Column2</td>
<td>Column3</td>
<td>Column4</td>
<td>Column5</td>
<td>Column6</td>
<td>Column7</td>
<td>Column8</td>
<td>Column9</td>
<td>Column10</td>
<td></td>
</tr>
</table>
</div>