Trying to align column heading with rows below it - css

I'm trying to align the column heading with the rows below it but the column headings appear slightly to the right. I tried removing margin and removing the overflow auto from the row below the heading but that does not work. How can align the column heading with the rows below it? Thank you.
full code at this codepen.
These columns appear slightly to the right
<div class="row" style="background-color: yellow;">
<div class="col-4"><span ng-click="sortBy('ID')">ID <i id="ID" class="fa fa-caret-down"></i></span></div>
<div class="col-4"><span ng-click="sortBy('Name')">Bird Name <i id="Name" class="fa fa-caret-down"></i></span></div>
<div class="col-4"><span ng-click="sortBy('Type')">Type of Bird <i id="Type" class="fa fa-caret-down"></i></i></span></div>
</div>
These appear correctly.
<div id="data-row">
<div class="row" ng-repeat="birds in list | filter:filterText | orderBy:sortField:reverseOrder" style="width: 100%;">
<div class="col-4">{{birds.ID}}</div>
<div class="col-4">{{birds.Name}}</div>
<div class="col-4">{{birds.Type}}</div>
</div>
</div>

You need no-gutters on both the row with the headings and the rows with the data and you don't need the width: 100% on the #data-row.
<link href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/js/bootstrap.bundle.min.js"></script>
<style>
body {
margin: 0 auto;
}
a {
text-decoration: none;
}
.container {
border: 1px solid black;
}
.content {
padding: 5px;
width: 100%;
}
#data-row {
/*width: 100%; */
min-height: 200px;
max-height: 500px;
overflow: auto;
}
.row:nth-child(even) {
background: #CCC
}
.row:nth-child(odd) {
background: #FFF
}
.row .section-header {
padding: 5px !important;
background-color: #7C9DB9 !important;
}
.header-span {
color: #fff;
margin-right: .7em;
cursor: pointer;
font-size: 1.5em;
}
.span-active {
border-bottom: solid 1px #fff;
}
.col-4 {
border: solid 1px red;
}
.overflow-y {
overflow-y: scroll;
}
</style>
<div ng-app="myApp" ng-controller="myController">
<div class="container">
<div class="row section-header" style="padding: 5px; background-color: #7C9DB9">
<div class="col-12">
<span class="header-span" ng-repeat="tab in tabs" ng-click="update($index, tab.value)" ng-class="{'span-active': tab.active}">
{{tab.label}}
</span>
</div>
</div>
<label>Search: <input ng-model="searchText"></label>
<div class="row no-gutters overflow-y" style="background-color: yellow;">
<div class="col-4"><span ng-click="sortBy('ID')">ID <i id="ID" class="fa fa-caret-down"></i></span></div>
<div class="col-4"><span ng-click="sortBy('Name')">Bird Name <i id="Name" class="fa fa-caret-down"></i></span></div>
<div class="col-4"><span ng-click="sortBy('Type')">Type of Bird <i id="Type" class="fa fa-caret-down"></i></i></span></div>
</div>
<div id="data-row">
<div class="row no-gutters overflow-y" ng-repeat="birds in list | filter:filterText | orderBy:sortField:reverseOrder">
<div class="col-4">{{birds.ID}}</div>
<div class="col-4">{{birds.Name}}</div>
<div class="col-4">{{birds.Type}}</div>
</div>
</div>
</div>
</div>

Another way to go would be to use a table rather than rows and columns. Bootstrap-table is an extension can create a table for you where the columns align and you can have a scrollbar to scroll through the data. Bootstrap-table can also handle the search function and sorting the table by a column. You can have the table either hard coded into your page or you can build the table from a JSON file.
Bootstrap-table is being actively maintained, but they are a few version behind on Bootstrap 4 (they’re running 4.3.1 rather than 4.6.0).
I have replaced Bootstrap-table’s arrows for sorting columns as theirs (I believe) lack sufficient contrast).
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" rel="stylesheet"/>
<link href="https://unpkg.com/bootstrap-table#1.18.3/dist/bootstrap-table.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://unpkg.com/bootstrap-table#1.18.3/dist/bootstrap-table.min.js"></script>
<style>
.bootstrap-table {
margin-bottom: 1rem;
}
.bootstrap-table .fixed-table-container .table thead th .th-inner {
padding: 0.25rem;
}
.table td,
.table th {
padding: 0 0.25rem;
}
.bootstrap-table .fixed-table-container .table thead th .both {
background-image: url("data:image/svg+xml; charset=utf8, %3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100' fill='%23000000' opacity='0.56'%3E%3Cpolygon points='50,10 70,45 30,45'/%3E%3Cpolygon points='30,55 70,55 50,90' /%3E%3C/svg%3E");
background-size: 1.1875rem, 1.1875rem;
}
.bootstrap-table .fixed-table-container .table thead th .asc {
background-image: url("data:image/svg+xml; charset=utf8, %3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23000000' opacity='0.69'%3E%3Cpolygon points='50,10 70,45 30,45'/%3E%3C/svg%3E");
background-size: 1.1875rem, 1.1875rem;
}
.bootstrap-table .fixed-table-container .table thead th .desc {
background-image: url("data:image/svg+xml; charset=utf8, %3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23000000' opacity='0.69'%3E%3Cpolygon points='30,55 70,55 50,90' /%3E%3C/svg%3E");
background-size: 1.1875rem, 1.1875rem;
}
</style>
<div ng-app="myApp" ng-controller="myController">
<div class="container">
<div class="row section-header" style="padding: 5px; background-color: #7C9DB9">
<div class="col-12">
<span class="header-span" ng-repeat="tab in tabs" ng-click="update($index, tab.value)" ng-class="{'span-active': tab.active}">
{{tab.label}}
</span>
</div>
</div>
<label>Search: <input ng-model="searchText"></label>
<table class="table table-bordered mb-5" data-toggle="table" data-search="true" data-height="468" data-show-columns="true">
<thead>
<tr>
<th data-field="id" data-sortable="true">ID</th>
<th data-field="name" data-sortable="true">Bird Name</th>
<th data-field="type" data-sortable="true">Type of Bird</th>
</tr>
</thead>
<tbody>
<tr>
<th>1</th>
<td>Eurasian Collared-Dove</td>
<td>Hawk</td>
</tr>
<tr>
<th>2</th>
<td>Bald Eagle</td>
<td>Sparrow</td>
</tr>
<th>3</th>
<td>Cooper's Hawk</td>
<td>Sparrow</td>
</tr>
<tr>
<th>4</th>
<td>Bell's Sparrow</td>
<td>Sparrow</td>
</tr>
<tr>
<th>5</th>
<td>Mourning Dove</td>
<td>Dove</td>
</tr>
<tr>
<th>6</th>
<td>Rock Pigeon</td>
<td>Dove</td>
</tr>
<tr>
<th>7</th>
<td>Abert's Towhee</td>
<td>Sparrow</td>
</tr>
<tr>
<th>8</th>
<td>Brewer's Sparrow</td>
<td>Hawk</td>
</tr>
<tr>
<th>9</th>
<td>Canyon Towhee</td>
<td>Hawk</td>
</tr>
<tr>
<th>10</th>
<td>Black Vulture</td>
<td>Dove</td>
</tr>
<tr>
<th>11</th>
<td>Eurasian Collared-Dove</td>
<td>Hawk</td>
</tr>
<tr>
<th>12</th>
<td>Bald Eagle</td>
<td>Sparrow</td>
</tr>
<tr>
<th>13</th>
<td>Cooper's Hawk</td>
<td>Sparrow</td>
</tr>
<tr>
<th>14</th>
<td>Bell's Sparrow</td>
<td>Sparrow</td>
</tr>
<tr>
<th>15</th>
<td>Mourning Dove</td>
<td>Dove</td>
</tr>
<tr>
<th>16</th>
<td>Rock Pigeon</td>
<td>Dove</td>
</tr>
<tr>
<th>17</th>
<td>Abert's Towhee</td>
<td>Sparrow</td>
</tr>
<tr>
<th>18</th>
<td>Brewer's Sparrow</td>
<td>Hawk</td>
</tr>
<tr>
<th>19</th>
<td>Canyon Towhee</td>
<td>Hawk</td>
</tr>
<tr>
<th>20</th>
<td>Black Vulture</td>
<td>Dove</td>
</tr>
<tr>
<th>21</th>
<td>Eurasian Collared-Dove</td>
<td>Hawk</td>
</tr>
<tr>
<th>22</th>
<td>Bald Eagle</td>
<td>Sparrow</td>
</tr>
<tr>
<th>23</th>
<td>Cooper's Hawk</td>
<td>Sparrow</td>
</tr>
<tr>
<th>24</th>
<td>Bell's Sparrow</td>
<td>Sparrow</td>
</tr>
<tr>
<th>25</th>
<td>Mourning Dove</td>
<td>Dove</td>
</tr>
<tr>
<th>26</th>
<td>Rock Pigeon</td>
<td>Dove</td>
</tr>
<tr>
<th>27</th>
<td>Abert's Towhee</td>
<td>Sparrow</td>
</tr>
<tr>
<th>28</th>
<td>Brewer's Sparrow</td>
<td>Hawk</td>
</tr>
<tr>
<th>29</th>
<td>Canyon Towhee</td>
<td>Hawk</td>
</tr>
<tr>
<th>30</th>
<td>Black Vulture</td>
<td>Dove</td>
</tr>
<tr>
<th>31</th>
<td>Eurasian Collared-Dove</td>
<td>Hawk</td>
</tr>
<tr>
<th>32</th>
<td>Bald Eagle</td>
<td>Sparrow</td>
</tr>
<tr>
<th>33</th>
<td>Cooper's Hawk</td>
<td>Sparrow</td>
</tr>
<tr>
<th>34</th>
<td>Bell's Sparrow</td>
<td>Sparrow</td>
</tr>
<tr>
<th>35</th>
<td>Mourning Dove</td>
<td>Dove</td>
</tr>
<tr>
<th>36</th>
<td>Rock Pigeon</td>
<td>Dove</td>
</tr>
<tr>
<th>37</th>
<td>Abert's Towhee</td>
<td>Sparrow</td>
</tr>
<tr>
<th>38</th>
<td>Brewer's Sparrow</td>
<td>Hawk</td>
</tr>
<tr>
<th>39</th>
<td>Canyon Towhee</td>
<td>Hawk</td>
</tr>
<tr>
<th>40</th>
<td>Black Vulture</td>
<td>Dove</td>
</tr>
</tbody>
</table>
</div>
</div>

Related

CSS DIV width based on text length with position absolute relative to a TABLE cell

Brief introduction:
with my attempts I have reached an acceptable result
to a specific table cell I set inline the (in the screenshots below it is the third last TH)
<th style="position:relative;">Column Name</th>
then inside the cell I have positioned my DIV
<th style="position:relative;"><div id="myDiv" style="position:relative;">Line 1 - medium length<br>Line2 - John</div></th>
EDIT: as requested I post the significant code
the DIV CSS
#provDiv{ /** the DIV CSS */
position: absolute;
top: 0;
right: 0;
width: auto;
background: greenyellow;
text-align: right;
}
the involved cell,
<th data-dbrow="device" scope="col"
style="position:relative; width: 10%">
<div id="provDiv">Line 1 - medium length<br>Line 2 - John</div>
</th>
What it happen is that (I'd say "obviously") the DIV long text will wrap, because the DIV will have as maximum width -> the table column's width, this using width: auto;
while if I set width: 300px the DIV width is really 300px
with fixed width, I have the DIV larger than the column width,
but then the div is ALWAYS large 300px, despite the content,
so if DIV innerText is just 5 chars like "hello", I have a laaaaarge DIV quite awful to see.
Well the question is:
how to have the DIV WIDTH that adapts to the text line length, without using a fixed width?
please note that I must use bootstrap 5
if it can help in this case, I'm available to use flexbox, but I haven't studied it yet
These are my tests
current result with auto and two text lines long text
worse result with fixed width and short text
1th wanted result
2nd wanted result
Check the classes = parent, myDiv. This is a mix of using table and flexbox layout
#customers {
font-family: Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#customers td, #customers th {
border: 1px solid #ddd;
height: 35px;
}
#customers tr:nth-child(even){background-color: #f2f2f2;}
#customers tr:hover {background-color: #ddd;}
#customers th {
text-align: left;
background-color: #04AA6D;
color: white;
}
/* Check the styles below*/
.parent {
display: flex;
align-items: center;
}
.myDiv {
background-color: red;
height: 100%;
width: fit-content;
padding: 0 10px;
margin-left: auto;
display: flex;
align-items: center;
}
<table id="customers">
<thead>
<tr>
<th class="parent">
Company
<div class="myDiv">Hello World</div>
</th>
<th>Contact</th>
<th>Country</th>
</tr>
</thead>
<tbody>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Berglunds snabbköp</td>
<td>Christina Berglund</td>
<td>Sweden</td>
</tr>
</tbody>
</table>
And you can hide large text and show dots instead if the width of myDiv is more than 300px:
.myDiv {
text-overflow: ellipsis;
overflow: hidden;
max-width: 300px;
white-space: nowrap;
}
EDIT: Solution for your code
Check:
#provDiv{
position: absolute;
top: 0;
right: 0;
width: fit-content;
padding: 0 5px;
background: greenyellow;
text-align: right;
/*ADDED*/
text-overflow: ellipsis;
overflow: hidden;
max-width: 300px;
white-space: nowrap;
}
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="icon" type="image/png" href="/favicon-32x32.png">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<style>
#provDiv{
position: absolute;
top: 0;
right: 0;
width: fit-content;
padding: 0 5px;
background: greenyellow;
text-align: right;
text-overflow: ellipsis;
overflow: hidden;
max-width: 300px;
white-space: nowrap;
}
</style>
<title>Title</title>
</head>
<body>
<div class="container-fluid">
<div class="d-flex flex-wrap">
<div class="col-xl-6 col-sm-12">
<div class="d-flex justify-content-start">
<h1 class="p-1">Calls</h1>
<p id="provincie"></p>
</div>
</div>
<div class="col-xl-6 col-sm-12">
<div class="d-flex flex-wrap justify-content-end">
<div>
<button class="btn btn-primary m-3" id="AggiungiRiga" type="submit" value="Submit" >+ Riga</button>
</div>
<div>
<button class="btn btn-danger m-3" id="EliminaRiga" type="submit" value="Submit" >- Riga</button>
</div>
<div>
<button class="btn btn-success m-3" id="SalvaRiga" type="submit" value="Submit" >Salva</button>
</div>
</div>
</div>
</div>
<div class="table-responsive">
<table style="min-width:1000px;" class="table table-striped table-hover table-bordered text-center" id="tabella">
<thead>
<tr>
<th data-dbrow="riga" scope="col" style="width: 5%">#</th>
<th data-dbrow="id" scope="col" style="width: 5%">ID</th>
<th data-dbrow="nome" scope="col" style="width: 30%">Nome</th>
<th data-dbrow="tel" scope="col" style="width: 11%">Telefono</th>
<th data-dbrow="mail" scope="col" style="width: 29%">Email</th>
<th data-dbrow="device" scope="col" style="position:relative; width: 10%">
<select id="select1" class="form-select form-select-sm">
<option value="$" selected disabled>- Text 1 -</option>
<option value="val1">Text 2</option>
<option value="val2">Text 3</option>
<option value="val2">Text 4</option>
</select>
<div id="provDiv">Line 1 - medium length<br>Line 2 - John</div>
</th>
<th data-dbrow="iscli" scope="col" style="width: 5%">È Cli</th>
<th data-dbrow="prov" scope="col" class="cellaProv" style="width: 5%">Prov</th>
</tr>
</thead>
<tbody id="table1bd">
<tr>
<th>some text</th>
<td>some text</td>
<td contenteditable="true">some text</td>
<td contenteditable="true">some text</td>
<td contenteditable="true">some text</td>
<td>some text</td>
<td contenteditable="true">some text</td>
<td contenteditable="true">some text</td>
</tr>
<tr>
<th>some text</th>
<td>some text</td>
<td contenteditable="true">some text</td>
<td contenteditable="true">some text</td>
<td contenteditable="true">some text</td>
<td>some text</td>
<td contenteditable="true">some text</td>
<td contenteditable="true">some text</td>
</tr>
<tr>
<th>some text</th>
<td>some text</td>
<td contenteditable="true">some text</td>
<td contenteditable="true">some text</td>
<td contenteditable="true">some text</td>
<td>some text</td>
<td contenteditable="true">some text</td>
<td contenteditable="true">some text</td>
</tr>
</tbody>
</table>
</div>
</div>
<pre></pre>
<!-- Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous"></script>
</body>
</html>

Trying to use table to achieve CSS responsiveness but not working

I am trying to make the following page responsive. But when I hit 550px width I got the following result. If I go further down the resolution all my stuff will be slanted to the left except for the footer. I am a beginner trying to learn responsive design. I really appreciate all the help I can get. If you can provide a bit of explanation it will be great. All help is deeply appreciated. Thank you in advance.
https://jsfiddle.net/hansheung/Lhyk3s86/1/
CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;" />
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans">
<title>Benefits</title>
<style type="text/css">
body {
width: 100%;
background-color: #ffffff;
margin: 0;
padding: 0;
font-family: 'Open Sans'
}
p,
h1,
h2,
h3,
h4 {
margin-top: 0;
margin-bottom: 0;
padding-top: 0;
padding-bottom: 0;
}
html {
width: 100%;
}
table {
font-size: 14px;
border: 0;
}
/* ----------- responsivity ----------- */
#media only screen and (max-width: 640px) {
/*------ top header ------ */
.main-header {
font-size: 20px !important;
}
.main-section-header {
font-size: 28px !important;
}
.show {
display: block !important;
}
.hide {
display: none !important;
}
.align-center {
text-align: center !important;
padding-top: 20px;
}
.align-left {
text-align: left !important;
padding-bottom: 20px;
}
.no-bg {
background: none !important;
}
/*----- main image -------*/
.main-image img {
width: 640px !important;
height: auto !important;
}
/*-------- container --------*/
.container600 {
width: 460px !important;
}
/*-------- secions ----------*/
/* .section-img img {
width: 640px !important;
height: auto !important;
} */
}
#media only screen and (max-width: 600px) {
/*------ top header ------ */
.main-header {
font-size: 18px !important;
}
.main-section-header {
font-size: 26px !important;
}
/*-------- container --------*/
.container600 {
width: 400px !important;
}
/*-------- secions ----------*/
/* .section-img img {
width: 600px !important;
height: auto !important;
} */
}
.responsive{
width: 100%;
height: auto;
}
#font-face {
font-family: Kollektif Regular;
src: url(http://www.talent-trust.com/public-html/fonts/Kollektif.woff);
}
#font-face {
font-family: Kollektif Bold;
src: url(http://www.talent-trust.com/public-html/fonts/Kollektif-Bold.woff);
}
#font-face {
font-family: Kollektif Italic;
src: url(http://www.talent-trust.com/public-html/fonts/Kollektif-Italic.woff);
}
#font-face {
font-family: Kollektik BoldItalic;
src: url(http://www.talent-trust.com/public-html/fonts/Kollektif-BoldItalic.woff);
}
.text{
color: #2d2a26;
font-size: 16px;
line-height: 28px;
text-align: justify;
}
.singleLine{
line-height:16px;
}
.doubleLine{
line-height:40px;
}
.subtitle{
font-size: 20px;
color:#FF7F30;
}
.text-color{
color: #ffffff;
font-size: 14px;
line-height: 23px;
}
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- header -->
<table width="100%" bgcolor="ffffff">
<tr>
<td >
<table align="center" width="600" class="container600">
<tr>
<td height="10" > </td>
</tr>
<tr>
<td>
<table border="0" align="center" width="600" class="container600">
<tr>
<td class="section-img">
<a href="http://www.talent-trust.com" ><img src="http://www.talent-trust.com/documents/img/j19-ttc_header.png" width="640"/></a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10"> </td>
</tr>
</table>
</td>
</tr>
</table>
<!-- end header -->
<!-- big banner section -->
<table width="100%" >
<tr>
<td align="center" valign="top" style="background:#ffffff url(http://www.talent-trust.com/documents/img/j19-ttc_banner.jpg);background-repeat:no-repeat;background-position:center;background-size:cover;border-top:0;border-bottom:0;padding-top:150px;padding-bottom:150px">
<table align="center">
<tr>
<td valign="top"></td>
</tr>
</table>
</td>
</tr>
</table>
<!--end banner-->
<table border="0" align="center" width="70%" cellpadding="0" cellspacing="0" class="container600">
<tr>
<td style="line-height: 50px;"> </td>
</tr>
<tr>
<td align="justified" style="color: #053D56; font-size: 40px; font-family: Kollektif; line-height: 28px;">
<p>Member Benefits</p>
</td>
</tr>
<tr>
<td class="doubleLine"> </td>
</tr>
<tr>
<td class="text">
At TTc, we aim to give missionaries the security, physical health, mental health, and wellness support and resources that they need to excel in their calling and stay in the field longer.
</td>
</tr>
<tr>
<td class="doubleLine"> </td>
</tr>
<tr>
<td align="center">
<table border="0" width="70%" align="center" cellpadding="0" cellspacing="0" bgcolor="#ff7f30">
<tr>
<td height="2" style="font-size: 2px; line-height: 2px;"> </td>
</tr>
</table>
</td>
</tr>
</table>
<!-- 2 Column Blog Layout-->
<table width="100%">
<tr>
<td align="center">
<table border="0" align="center" width="100%" cellpadding="0" cellspacing="0" class="container600">
<tr>
<td>
<table width="50%" align="left" cellpadding="80px" cellspacing="0" class="container600">
<tr>
<td class="align-center">
<div>
<p style="color: #053D56; font-size: 30px; font-family: Kollektif; line-height: 28px;">Keeping your costs down</p>
<br>
<p class="text">We know cost is a big deal, so we provide multiple ways to keep costs down:</p>
<br>
<p class="text">
No Claims Bonus – We reward our members for staying healthy, which helps us to keep our premiums down. See how you can save up to 50% of your premium. <a href="http://www.talent-trust.com/benefits/ncb.html" target="blank" >Read more…</a>
</p>
<br>
</div>
</td>
</tr>
</table>
<table width="50%" align="right" cellpadding="80px" cellspacing="0" class="container600">
<tr>
<td class="align-center">
<div >
<p style="color: #053D56; font-size: 30px; font-family: Kollektif; line-height: 28px;">Tailored Services help you THRIVE Long-Term</p>
<br>
<p class="text">We look at what services and technology we can offer that will help our members to stay in the field longer.</p>
<br>
<p class="text">
vHealth – a 24/7 service that connects you to a European based family doctor from anywhere in the world for free. Using an app on your phone, you can video call or have a vHealth doctor visit whenever and wherever you need it. <a href="http://www.talent-trust.com/benefits/vhealth.html" target="blank" >Read more…</a>
</p>
<br>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="50" style="font-size: 50px; line-height: 50px;"> </td>
</tr>
</table>
</td>
</tr>
</table>
<!-- end section -->
<tr>
<td class="text">
</td>
</tr>
<tr>
<td class="singleLine"> </td>
</tr>
<tr>
<td class="text">
</td>
</tr>
<tr>
<td class="singleLine"> </td>
</tr>
<tr>
<td class="text">
</td>
</tr>
<tr>
<td class="singleLine"> </td>
</tr>
<tr>
<td class="text">
</td>
</tr>
<tr>
<td class="singleLine"> </td>
</tr>
<tr>
<td class="text">
</td>
</tr>
<tr>
<td class="singleLine"> </td>
</tr>
<tr>
<td height="50" style="font-size: 30px; line-height: 30px;"> </td>
</tr>
</table>
<!-- end section -->
<!-- contact section -->
<table width="100%" bgcolor="#053D66">
<tr>
<td height="40" style="font-size: 40px; line-height: 40px;"> </td>
</tr>
<tr>
<td >
<table width="600" cellpadding="0" cellspacing="0" bgcolor="#ff7f30">
<tr>
<!-- <td height="2" style="font-size: 2px; line-height: 2px;"> </td> -->
</tr>
</table>
</td>
</tr>
<tr>
<td >
<table align="center" width="700" class="container600">
<tr>
<td>
<table width="300" align="left" cellpadding="0" cellspacing="0" class="container600">
<tr>
<!-- logo -->
<td align="right" class="align-center">
<a href="http://www.talent-trust.com" ><img width="200" border="0" style="display: block; width: 200px;" src="http://www.talent-trust.com/documents/img/j19-logo_footer.png" alt="" /></a>
</td>
</tr>
<tr>
<td height="25"> </td>
</tr>
<tr>
<td style="text-align:right;" class="align-left"><img width="24" height="24" src="http://www.talent-trust.com/documents/img/j19-fb_icon.png" ></td>
</tr>
</table>
<table width="2" align="left" cellpadding="20" cellspacing="0" style="border-collapse:collapse;" class="container600">
<tr>
<td class="hide" width="2" height="25"></td>
</tr>
</table>
<table width="250" align="left" cellpadding="0" cellspacing="0" style="border-collapse:collapse;" class="container600">
<tr>
<td align="left">
<div class="text-color">
Email us: abc#hotmail.com
</div>
</td>
</tr>
<tr>
<td height="15" style="font-size: 15px; line-height: 15px; color: #ffffff;">Tel: +604-899-8945</td>
</tr>
<tr>
<td height="33" style="font-size: 33px; line-height: 33px;"></td>
</tr>
<tr>
<td>
<table align="left" cellpadding="0" cellspacing="0">
<tr>
<td class="text-left p1"><img width=24 height=24 src="http://www.talent-trust.com/documents/img/j19-youtube_icon.png" ></td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="60"> </td>
</tr>
</table>
<!-- end section -->

Materialize fixed header and scroll, issue with footer and mobile

I have the following materialize table:
<div class="row">
<div class="col s12 m12 l12">
<div id="table" class="card card card-default scrollspy">
<div class="card-content material-table ">
<h4 class="card-title">Users Live Results</h4>
<div class="row">
<div class="col s12"></div>
<div class="col s12">
<table class="responsive-table striped">
<thead>
<tr>
<th style="text-align:left;">User</th>
<th style="text-align:right;">RM Deposits</th>
<th style="text-align:right;">RM+RB GGR</th>
<th style="text-align:right;">RM Win</th>
<th style="text-align:right;">RB Win</th>
<th style="text-align:right;">PB Win</th>
<th style="text-align:right;">RM&RB Balance</th>
<th style="text-align:right;">Bo Deposits</th>
<th style="text-align:right;">Withdrawals</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;">Moha</td>
<td style="text-align:right;">140</td>
<td style="text-align:right;">140</td>
<td style="text-align:right;">140</td>
<td style="text-align:right;">0</td>
<td style="text-align:right;">0</td>
<td style="text-align:right;">140</td>
<td style="text-align:right;">0</td>
<td style="text-align:right;">0</td>
</tr>
<tr>
<td style="text-align:left;">handx</td>
<td style="text-align:right;">0</td>
<td style="text-align:right;">99</td>
<td style="text-align:right;">0</td>
<td style="text-align:right;">99</td>
<td style="text-align:right;">151</td>
<td style="text-align:right;">0</td>
<td style="text-align:right;">250</td>
<td style="text-align:right;">0</td>
</tr>
<tr>
<td style="text-align:left;">Arff</td>
<td style="text-align:right;">0</td>
<td style="text-align:right;">19</td>
<td style="text-align:right;">19</td>
<td style="text-align:right;">0</td>
<td style="text-align:right;">106</td>
<td style="text-align:right;">13</td>
<td style="text-align:right;">0</td>
<td style="text-align:right;">0</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>Total</td>
<td style="text-align:right;">140</td>
<td style="text-align:right;">260</td>
<td style="text-align:right;">161</td>
<td style="text-align:right;">99</td>
<td style="text-align:right;">257</td>
<td style="text-align:right;"></td>
<td style="text-align:right;">250</td>
<td style="text-align:right;">0</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
I used a CSS fixed header and scroll for tables with a lot of data with the following css:
table {
font-size: 12px;
}
tbody {
display:block;
height:200px;
overflow:auto;
}
thead, tbody tr {
display:table;
width:100%;
table-layout:fixed;
}
thead {
width: calc( 100% - 1em )
}
table {
width:100%;
}
It is working but the footer of the table is outside of the scroll section (offset)
as per this screenshot:
Finally, on small devices, the scroll does not work at all, so I should exclude the CSS for smaller devices and I did not find any solution to do so.
Thanks for your help !
You have too much CSS in the table which offset's the natural CSS that is there. You can add padding to the td tag to set up how you want it to be spaced.
You can play with the different heights you need ( the table or content is set to whatever height and same for the parent container to make sure it scrolls ).
table {
font-size: 12px;
width: 70%;
height: 500px;
}
tbody {
overflow:auto;
}
thead, tbody tr {
table-layout:fixed;
}
thead {
width: calc( 100% - 1em )
}
.SetContainer{
height: 200px;
overflow: auto;
}
https://jsfiddle.net/86rnu03L/1/

Background color not displaying in Firefox

I have an issue where code in IE shows color formatting correctly, but when using Firefox, it does not.
I've tried to use Firebug, I can see where the cells are and that the "style" gets loaded correctly, but it just doesn't display the background color in Firefox...
Relevant code looks like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Internal Radiant Support - Agent Stats</title>
<!-- Stylesheet -->
<style type="text/css">
table.default {
empty-cells:hide;
border-spacing: 2px;
background-color: rgb(0, 0, 0);
empty-cells:hide;
}
table.default th {
padding: 2px 2px 2px 2px;
background-color: #E4E4E4;
}
table.default td {
padding: 2px 2px 2px 2px;
background-color: #FFFFFF;
}
</style>
</head>
<body bgcolor="#FFFFFF" height="100%" text="#000000" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" marginheight="0" marginwidth="0">
<form action="" method="post" name="crs_form" style="margin-top: 0; margin-right: 0; margin-left: 0; margin-bottom: 0;">
<table align="center" class="default">
<tr class="default">
<th><input type="submit" name="agent_stats_PC[calendar][navigate][previous]" value="<"></th>
<th colspan="6"><input type="submit" name="agent_stats_PC[calendar][navigate][month]" value="February"><input type="submit" name="agent_stats_PC[calendar][navigate][month]" value="2013"></th>
<th><input type="submit" name="agent_stats_PC[calendar][navigate][next]" value=">"></th>
</tr>
<tr class="default">
<th width="35">S</th>
<th width="35">M</th>
<th width="35">T</th>
<th width="35">W</th>
<th width="35">T</th>
<th width="35">F</th>
<th width="35">S</th>
<th width="35">W</th>
</tr>
<tr class="default">
<td style="align=center; background-color=#C4C4C4;">27</td>
<td>28</td>
<td>29</td>
<td>30</td>
<td>31</td>
<td>01</td>
<td style="align=center; background-color=#E4E4E4;">02</td>
</tr>
<tr class="default">
<td style="align=center; background-color=#E4E4E4;">03</td>
<td>04</td>
<td>05</td>
<td>06</td>
<td>07</td>
<td>08</td>
<td style="align=center; background-color=#E4E4E4;">09</td>
</tr>
<tr class="default">
<td style="align=center; background-color=#E4E4E4;">10</td>
<td>11</td>
<td>12</td>
<td>13</td>
<td>14</td>
<td>15</td>
<td style="align=center; background-color=#E4E4E4;">16</td>
</tr>
<tr class="default">
<td style="align=center; background-color=#E4E4E4;">17</td>
<td>18</td>
<td>19</td>
<td>20</td>
<td>21</td>
<td>22</td>
<td style="align=center; background-color=#E4E4E4;">23</td>
</tr>
<tr class="default">
<td style="align=center; background-color=#C4C4C4;">24</td>
<td>25</td>
<td>26</td>
<td>27</td>
<td>28</td>
<td>01</td>
<td style="align=center; background-color=#E4E4E4;">02</td>
</tr>
</table>
<br /><table align="center" class="default">
<tr class="default">
<th>Agent Stats Converter</th>
</tr>
<tr class="default">
<td><textarea name="agent_stats_PC[import][data]" cols="32" rows="8"></textarea></td>
</tr>
<tr class="default">
<th><input type="submit" name="agent_stats_PC[import][button]" value="Submit"><input type="submit" name="agent_stats_PC[import][button]" value="Cancel"></th>
</tr>
</table>
</form>
</body>
</html>
You mix up css in tags and in the css area - but that is not the problem.
If you mean this part:
<td style="align=center; background-color=#C4C4C4;">27</td>
then it is
<td style="text-align:center; background-color:#C4C4C4;">27</td>
: is css, = is used like this:
<td background="..." ...

“vertical-align: middle” on table cells does not align to the middle with AlphaImageLoader in IE6

I'm trying to align some text on table cells with a PNG Transparent background, I uses the filter:progid:DXImageTransform.Microsoft.AlphaImageLoader() to fix this in IE6. But the text does not align to the middle with the style filter:
CSS:
.fh {
font-family:SimSun;
font-size:12px;
overflow:hidden;
padding:0 2px 2px;
text-align:left;
vertical-align:middle;
}
HTML:
<table width="200" border="1" cellpadding="2" class="x-table">
<tr>
<th scope="col"> </th>
</tr>
<tr style="height: 77px;">
<td class="fh" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='./shadow-trans.png')"> ABCDEFG</td>
</tr>
</table>
Screenshot:
"vertical_align_ie6" http://filer.blogbus.com/4216262/resource_4216262_1279530625v.png
Try shifting the height to the TD or the TABLE.
I find that this problem can be fixed by insert a div with a table in it to the origin td:
HTML:
<table cellspacing="0" cellpadding="0" class="x-table" style="position: absolute; width: 289px; left: 0px;">
<colgroup>
<col style="width: 72px;"/>
<col style="width: 72px;"/>
<col style="width: 72px;"/>
<col style="width: 72px;"/>
</colgroup>
<tbody>
<tr style="height: 77px;">
<td class="brw1 brss bbw1 bbss blw1 blss btw1 btss" style="border-color: rgb(153, 204, 255); filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='./shadow-trans.png', sizingMethod=crop);background-repeat: no-repeat;" id="A1-0" colspan="4">
<div class="fx" style="height: 76px;">
<table>
<tbody>
<tr>
<td class="fh bw" style="height: 76px; width: 288px;">ABCDEFG</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>

Resources