Hide scrollable element under a sticky element - html

I want to hide the second header when it goes under the first header on small resolution when it scroll, I realy don't know how to do it, I tried everything.
.horizontal-scroll-table > .row::-webkit-scrollbar {
display: none;
background-color: red;
width: 500px;
}
table thead th {
background-color: red;
color: white;
padding: 16px 24px;
}
table thead th:last-child {
border-radius: 0 50px 50px 0;
}
table thead th:first-child {
border-radius: 50px 0 0 50px;
position: sticky !important;
left: 0;
z-index: 999;
}
#media (max-width: 991px) {
.horizontal-scroll-table > .row {
overflow-x: scroll;
white-space: nowrap;
overflow-y: hidden;
}
.horizontal-scroll-table > .row > .col-md-12 {
display: inline-block;
float: none;
}
}
<div class="horizontal-scroll-table">
<div class="row" style="text-align: -webkit-center;">
<table>
<thead class="" style="background-color: #111A40;">
<tr>
<th>Sticky header</th>
<th>header</th>
<th>header</th>
<th>header</th>
</tr>
</thead>
</table>
</div>
</div>
here it's an example try to scroll on small size

An interesting use case. I would have completely different approach; would this work for you?
header > div {
display: inline-block;
border: 1px solid red;
width: 120px;
}
header {
white-space: nowrap;
}
/* actual solution */
header > div:nth-of-type(1) {
background: lightpink;
position: sticky;
left: 0;
}
<header>
<div>Sticky</div>
<div>Child1</div>
<div>Child2</div>
<div>Child3</div>
<div>Child4</div>
<div>Child5</div>
<div>Child6</div>
<div>Child7</div>
</header>

Related

How to make text hidden on overflow in td when the table positioned between two elements

I have a header with logo, table of some data and some button. Data in table can be different and large. So I want to hide the text on overflow.
Normal view:
When it overflowed:
What I want:
I tried to add to td in css:
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
But it doesn't help me.
.top-row {
height: 60px;
padding: 10px 10px 10px 10px;
width: 100%;
}
td {
font-size: 10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: initial;
word-break: break-word;
}
header {
position: fixed;
top: 0;
transition: top 0.2s ease-in-out;
width: 100%;
z-index: 1;
}
.navbar-toggler {
background-color: rgba(255, 255, 255, 0.1);
width: 60px;
height: 40px;
font-size: 14px;
padding: 4px 0 0 0;
}
.container-fluid {
display: flex;
flex-wrap: nowrap;
}
td:first-child {
border-right: 1px solid white;
padding-right: 10px;
}
td:nth-child(2) {
padding-left: 10px;
}
.oi {
width: 32px;
top: -2px;
color: white;
}
.gradient-main-theme {
background: linear-gradient(to right, #0f0e40, #16436d);
color: white;
}
<header class="gradient-main-theme">
<div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid">
<a class="navbar-brand" href="">LOGO</a>
<table class="fl-table">
<tr>
<td>Username: Igor</td>
<td class="vertical-line">Email: kek#gmail.com</td>
</tr>
<tr></tr>
<tr>
<td>Profilo: Some profile</td>
<td class="vertical-line">Code: 234232</td>
</tr>
</table>
<NavLink>
<button class="navbar-toggler" type="button">
<span class="oi oi-menu"></span>
</button>
</NavLink>
</div>
</div>
</header>
(CodeSandbox)
use #media only screen for example
#media only screen and (max-width: 700px)
that font size and size div change

IE11: Extend table row beyond table on hover

I have an HTML table inside a container. On hover, I want to highlight the row, not only inside the table, but extending outside to the edges of the container.
This is my first attempt:
body {
display: flex;
justify-content: center;
}
.container {
display: flex;
justify-content: center;
width: 800px;
border: 1px dotted gray;
padding: 2rem;
}
table {
table-layout: fixed;
border-collapse: collapse;
width: 100%;
border: 1px dashed purple;
}
td, th {
padding: .25rem;
position: relative;
text-align: left;
}
tr:hover {
background: lightgray;
cursor: pointer;
}
tr:hover td:first-child::before, tr:hover td:last-child::after {
content: '';
position: absolute;
top: 0;
bottom: 0;
width: 2rem;
background-color: lightgray;
}
td:first-child::before {
left: -2rem;
}
td:last-child::after {
right: -2rem;
}
<div class="container">
<table>
<thead>
<th>Dato</th>
<th>Lok. nr.</th>
<th>Navn</th>
<th>Status</th>
</thead>
<tbody>
<tr>
<td>06.12.2016</td>
<td>25736</td>
<td>Josommar-<br>set</td>
<td>I arbeid</td>
</tr>
<tr>
<td>07.12.2016</td>
<td>10232</td>
<td>Mannbru-<br>holmen</td>
<td>Avsluttet</td>
</tr>
</tbody>
</table>
</div>
It works fine in Chrome, but I have to support IE11, and in IE the before and after elements do not have the correct height. You can see the result in the screenshot below.
How can I do this in a way that also works in IE11?

HTML: Set scroll on div table-row

Hello i try to set scroll in .chat .body (overflow-y: scroll), i try every code but not work.
thanks in advance !
////////////////////////////////////////
Code:
<div class="chat">
<div class="head"></div>
<div class="body">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td align="left" width="40">
<img src="http://www.exclutips.com/wp-content/uploads/2015/08/wordpress-custom-user-avatar.png" style="
width: 32px;
height: 32px;
display: block;
border: 1px solid rgba(0, 0, 0, .1);
cursor: pointer;
">
</td>
<td align="left" width="136">
<div class="user-name">User Name</div>
</td>
<td align="right">
<span class="online-icon"></span>
</td>
</tr>
</tbody>
</table>
</div>
<div class="footer">
<input type="text" placeholder="Search">
</div>
</div>
<style type="text/css">
* { font-family: "Segoe UI"; }
html {
font-size: 100%;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
height: 100%;
}
body {
margin: 0;
padding: 0;
background: #F2F2F2;
height: 100%;
}
input, select {
display: block;
width: 100%;
padding: 5px;
outline: none;
border-width: 1px;
border-style: solid;
border-radius: 0;
background: #fff;
font-size: 12px;
color: #6B6B6B;
appearance:normal;
-moz-appearance:none;
-webkit-appearance:none;
border-color: #BDBDBD;
}
div, textarea, input, select, button, a { box-sizing: border-box; -moz-box-sizing: border-box; }
.chat {
display: table;
border-left: 1px solid #ccc;
position: fixed;
height: 100%;
top: 0;
right: 0;
bottom: 0;
width: 200px;
margin: 0;
padding: 0;
background: #E1E1E1;
}
.chat .head {
display: table-row !important;
height: 52px;
}
.chat .body {
overflow-y: scroll;
display: table-row;
height: 100% !important;
}
.chat .body table {
cursor: pointer;
padding: 5px;
}
.chat .footer {
display: table-row !important;
}
</style>
Check demo here: http://chatiiii.hol.es/default.php
You can use jQuery to set .body height :
* {
box-sizing:border-box;
...
}
.chat {
display: block;
...
}
.chat .head {
height: 52px;
...
}
.chat .body {
overflow-y: auto;
...
}
and jQuery
$(document).ready(function () {
setSize();
$(window).on('resize',setSize);
});
function setSize(){
var CH = $('.chat').height(),
HH = $('.chat .head').height(),
FH = $('.chat .footer').height();
$('.chat .body').height(CH-HH-FH);
}
see full example here.
Remove display: table-row; from .chat .body.
use this style for .chat .body class , but you should duplicate user table in html until it come more than page's height , then you can see scroll comes.
.chat .body {
overflow-y: scroll;
height: 80%;
}
You should remove display: table-row , and also give a height less than 100% .

How can I make css of an overflowing div in a table cell important?

I am a newbie to css.
I have two td in a row of which first has overflow visible. The contents in the first div are overlapping with the second td as in the example below. I wish to make the div css properties like cursor: pointer over the second td. Thus, the div css properties should be on top of the second td.
Please help me with this.
https://jsfiddle.net/jt00uk3e/
Thanks.
table {
width: 0px;
table-layout: fixed;
}
td {
width:50px;
height:50px;
overflow: visible;
}
#td1 {
background-color: red;
}
#td2 {
background-color: green;
}
#div2 {
width: 200px;
height: 20px;
background-color: blue;
cursor: pointer;
}
<table>
<tr>
<td id="td2"><div id="div2"></div></td>
<td id="td1"></td>
</tr>
</table>
Add z-index to div
#div2 {
width: 200px;
height: 20px;
background-color: blue !important;
cursor: pointer;
position:relative;
z-index:
https://jsfiddle.net/jt00uk3e/6/
try this:
table {
width: 0px;
table-layout: fixed;
}
td {
width:50px;
height:50px;
overflow: visible;
}
#td1 {
background-color: red;
}
#td2 {
background-color: green;
}
#div2 {
position:relative;
z-index:1;
width: 200px;
height: 20px;
background-color: blue;
cursor: pointer;
}
<table>
<tr>
<td id="td2"><div id="div2"></div></td>
<td id="td1"></td>
</tr>
</table>

Table margin is weird

I would like to give the table a margin, that the table is not 100% of the #content div. But the table is bigger than the div(outside).
Here is my fiddle: jsfiddle
HTML code:
</form>
<table>
<tr>
<th>Jobart</th>
<th>Stadteil</th>
<th>Berufsfeld</th>
<th>Title</th>
<th>Vergütung</th>
<th>Gesucht zum(Datum)</th>
<th>Weitere Informationen</th>
</tr>
<tr>
<td>Gelegenheitsjob</td>
<td>Charlottenburg</td>
<td>Bau, Architektur, Vermessung</td>
<td>kl</td>
<td></td>
<td>0000-00-00</td>
<td>Weiter</td>
</tr>
<tr>
<td>Gelegenheitsjob</td>
<td>Charlottenburg</td>
<td>Bau, Architektur, Vermessung</td>
<td>kljlk</td>
<td>78678</td>
<td>2014-12-01</td>
<td>Weiter</td>
</tr>
<tr>
<td>Ausbildungsplatz</td>
<td>Lichtenberg</td>
<td>Gesundheit</td>
<td>kökölkölk</td>
<td>321321</td>
<td>2014-12-23</td>
<td>Weiter</td>
</tr>
<tr>
<td>Praktika</td>
<td>Tempelhof</td>
<td>Technik, Technologiefelder</td>
<td>hallo</td>
<td>1337€</td>
<td>2014-12-25</td>
<td>Weiter</td>
</tr>
<tr>
<td>Praktika</td>
<td>Reinickendorf</td>
<td>Medien</td>
<td>jljlkjljkl</td>
<td>7987987</td>
<td>2014-12-28</td>
<td>Weiter</td>
</tr>
</table>
CSS code:
* {
margin: 0;
padding: 0;
}
body {
background-color: gray;
width: 100%;
}
#header {
background-color: blue;
height: 250px;
width: 100%;
}
nav {
width: 100%;
height: 50px;
background-color: yellow;
}
nav ul {
margin: 0;
}
nav ul li {
list-style: none;
float: left;
display: block;
margin: 8px 0 0 50px;
}
nav a:link {
text-decoration: none;
color: #696969;
font-family: 'Oswald', sans-serif;
font-size: 22px;
}
nav a:visited {
color: #696969;
}
nav a:hover {
color: black;
}
nav a:active {
color: black;
}
#content {
clear: left;
background-color: white;
width: 100%;
height: 100%;
}
form {
padding: 30px;
}
table {
width: 100%;
margin: 30px;
border-collapse: collapse;
/*border-spacing: 8px;*/
}
table tr:nth-of-type(odd) td {
background-color: gray;
}
th {
background-color: #8dc043;
height: 50px;
border: 1px solid #578415;
}
tr {
border: 1px solid #578415;
}
td {
border: 1px solid #578415;
padding: 8px;
}
fieldset {
padding: 15px;
}
footer {
border: 1px solid red;
background-color: green;
height: 50px;
}
footer ul {
margin: 15px 0 0 0;
}
footer ul li {
list-style: none;
float: left;
display: block;
margin: 0 0 0 50px;
}
#wrapper {
margin: 0 auto;
width: 85%;
}
Hope, that somebody can help me!
The problem is that in your example the padding: 30px of your table is added to width: 100% which results in more than 100% of total width;
Example 1: Using percentages on table
HTML
<table>
...
</table>
CSS
table {
margin: 3%;
width: 94%;
}
Example 2 Using wrapper around table for pixelvalues
HTML
<div class="tablemargin">
<table>
...
</table>
</div>
CSS
.tablemargin {
margin: 30px; /*sets margin around the table*/
}
table {
width: 100%;
margin: 0; /*set margin to 0 or remove this property completely*/
}
You can use pixel size as well as percentages. 50px is 50 pixels. It would be like this:
nav {
width: 100px;
height: 50px;
background-color: yellow;
}