I'm using ngx-datatable. It uses transform: translate3d to position every row using its height. The problem comes when I put a dropdown inside and the element below it hides the dropdown's options. As shown in the follow images:
My ngx-datatable configuration:
<ngx-datatable #chemicalResistanceGrid class="table-striped"
[cssClasses]="..."
[rows]="..."
[count]="..."
[limit]="..."
[rowHeight]="68"
[headerHeight]="40"
[footerHeight]="40"
[scrollbarV]="true"
[scrollbarH]="true"
[columns]="gridColumns"
[rowClass]="getRowClass"
[columnMode]="'force'">
<!---->
</ngx-datatable>
These examples are simpler simulations of my problem:
If I set the row elements with a sequenced z-index, the child elements are shown like:
row 0 element: (z-index: 100)
row 1 element: (z-index: 99)
This solution is not an option. I want the same result as the z-index approach and the ideal solution needs to use CSS as well. This is how the layout need to look like.
This is the entire simulation code and its snippet:
ul {
background: #b6ff00;
border-radius: 0 0 10px 10px;
}
li {
list-style: none;
}
section.datatable-body {
width: 1252px;
height: 420px;
overflow-y: auto;
overflow-x: auto;
position: relative;
z-index: 10;
display: block;
box-sizing: border-box;
font-size: 13px;
line-height: 1.42857143;
color: #333;
}
section.datatable-selection {
box-sizing: border-box;
}
section.datatable-scroller {
height: 5576px;
width: 1650px;
display: inline-block;
white-space: nowrap;
box-sizing: border-box;
box-sizing: border-box;
}
section.datatable-row-wrapper {
position: absolute;
background-color: #f9f9f9;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
flex-direction: column;
box-sizing: border-box;
white-space: nowrap;
font-size: 13px;
line-height: 1.42857143;
color: #333;
box-sizing: border-box;
}
section.datatable-body-row {
height: 68px;
width: 1650px;
white-space: nowrap;
outline: none;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
flex-direction: row;
box-sizing: border-box;
direction: ltr;
}
section.datatable-row-center {
width: 1650px;
display: flex;
position: relative;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
flex-direction: row;
flex-flow: row;
box-sizing: border-box;
white-space: nowrap;
}
section.datatable-body-cell {
width: 150px;
min-width: 200px;
max-width: 600px;
height: 68px;
/**/
white-space: nowrap;
text-overflow: ellipsis;
overflow: visible !important;
overflow-x: visible !important;
overflow-y: visible !important;
vertical-align: top;
display: inline-block;
line-height: 1.625;
text-align: left;
padding: .8rem 1.2rem .5rem;
transition: width .3s ease;
border-bottom: 1px solid #ddd;
border-right: 1px solid #ddd;
box-sizing: border-box;
-webkit-box-direction: normal;
}
section.datatable-body-cell-label {
box-sizing: border-box;
white-space: nowrap;
display: block;
line-height: 1.625;
text-align: left;
-webkit-box-direction: normal;
}
section.form-horizontal {
box-sizing: border-box;
margin: 0;
outline: 0;
color: #666;
position: relative;
display: block;
line-height: 1.625;
white-space: nowrap;
text-align: left;
-webkit-box-direction: normal;
}
section.ngx-select {
-webkit-border-radius: 0 !important;
-webkit-box-shadow: none !important;
margin: 0;
padding: 0;
display: block;
width: 100%;
height: 32px;
box-sizing: border-box;
border: 1px solid #ccc;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
section.ngx-select-dropdown {
box-sizing: border-box;
margin: 0;
padding: 0;
display: block !important;
position: relative;
text-align: left;
}
section.ul {
width: 100%;
height: auto;
max-height: 200px;
overflow-x: hidden;
margin-top: 0;
position: absolute;
border: 1px solid red;
border-radius: 4px 4px;
bottom: 5px;
animation-name: flipInX;
animation-fill-mode: both;
box-sizing: border-box;
margin: 0;
padding: 0;
top: 100%;
left: 0;
z-index: 1000;
float: left;
min-width: 160px;
list-style: none;
font-size: 13px;
text-align: left;
}
.li {
box-sizing: border-box;
margin: 0;
padding: 0;
display: list-item;
text-align: -webkit-match-parent;
border: 1px solid red;
}
<html>
<head>
</head>
<body>
<section class="datatable-body">
<section class="datatable-selection">
<section class="datatable-scroller">
<section class="datatable-row-wrapper" style="transform: translate3d(0px, 0px, 0px);backface-visibility: hidden;">
<section class="datatable-body-row">
<section class="datatable-row-center">
<section class="datatable-body-cell">
<section class="datatable-body-cell-label">
<section class="form-horizontal">
<section class="ngx-select">
<section class="ngx-select-dropdown">
<ul id="ul">
<li class="li">Test 1</li>
<li class="li">Test 2</li>
<li class="li">Test 3</li>
<li class="li">Test 4</li>
<li class="li">Test 5</li>
<li class="li">Test 6</li>
<li class="li">Test 7</li>
<li class="li">Test 8</li>
<li class="li">Test 9</li>
<li class="li">Test 0</li>
</ul>
</section>
</section>
</section>
</section>
</section>
</section>
</section>
</section>
<section class="datatable-row-wrapper" style="transform: translate3d(0px, 68px, 0px);backface-visibility: hidden;">
<section class="datatable-body-row">
<section class="datatable-row-center">
<section class="datatable-body-cell">
<section class="datatable-body-cell-label">
<section class="form-horizontal">
<section class="ngx-select">
<section class="ngx-select-dropdown">
<ul id="ul">
<li class="li">Test 1</li>
<li class="li">Test 2</li>
<li class="li">Test 3</li>
<li class="li">Test 4</li>
<li class="li">Test 5</li>
<li class="li">Test 6</li>
<li class="li">Test 7</li>
<li class="li">Test 8</li>
<li class="li">Test 9</li>
<li class="li">Test 0</li>
</ul>
</section>
</section>
</section>
</section>
</section>
</section>
</section>
</section>
<section class="datatable-row-wrapper" style="transform: translate3d(0px, 136px, 0px);backface-visibility: hidden;">
<section class="datatable-body-row">
<section class="datatable-row-center">
<section class="datatable-body-cell">
<section class="datatable-body-cell-label">
<section class="form-horizontal">
<section class="ngx-select">
<section class="ngx-select-dropdown">
<ul id="ul">
<li class="li">Test 1</li>
<li class="li">Test 2</li>
<li class="li">Test 3</li>
<li class="li">Test 4</li>
<li class="li">Test 5</li>
<li class="li">Test 6</li>
<li class="li">Test 7</li>
<li class="li">Test 8</li>
<li class="li">Test 9</li>
<li class="li">Test 0</li>
</ul>
</section>
</section>
</section>
</section>
</section>
</section>
</section>
</section>
</section>
</section>
</section>
</body>
</html>
After some research I found the problem. The key point here is the transform element(transform:translate3d(0px, Xpx, 0px)). There is a note in W3school which enforce to use transform-style along with transformation. So, where ever I using transform I MUST use a desired transform-style mechanism; in this case preserve-3d which mean the children of the transformed element will keeps its own position. The other thing I noticed is the z-index doesn't works for the children of the transformed element. What was worked for me was the transform: translateZ(1px).
So:
database-scroller -> added transform-style: preserve-3d
datatable-row-wrapper -> keeps its transform:translate3d(0px, xxpx, 0px)
datatable-body-row.editMode(when it's in editMode)-> added transform: translateZ(1px);
$(function () {
$('.toggle-dropdown').on('click', function () {
var drop = $(this).parents('.container').find('.element');
var row = $(this).parents('.container').find('.row');
$(row).toggleClass('editMode');
$(this).html($(row).hasClass('editMode') ? '↑' : '↓');
});
});
section.wrapper {
position: relative;
transform-style: preserve-3d;
}
section.container {
position: absolute;
transform-style: preserve-3d;
height: 40px;
width: 100%;
background-color: aliceblue;
z-index: 1000;
}
div.cell {
width: 200px;
padding: 10px;
vertical-align: top;
display: inline-block;
position: relative;
}
div.editMode {
transform: translateZ(10px);
}
ul.element {
background-color: beige;
list-style: none;
z-index: 1000;
margin: 0;
padding-left: 5px;
display: none;
transition: visibility 0s, opacity 0.5s linear;
}
.editMode ul.element {
display: block;
}
.icon {
padding: 2px 5px;
background-color: gray;
border: 1px solid gray;
border-radius: 5px;
cursor: pointer;
}
<html>
<head>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
</head>
<body>
<section class="wrapper">
<section id="row1" class="container" style="transform:translate3d(0px, 0px, 0px)">
<div class="row">
<div class="cell">
<input type="text" /><span class="toggle-dropdown icon">↓</span>
<ul class="element">
<li>element 1</li>
<li>element 2</li>
<li>element 3</li>
</ul>
</div>
<div class="cell">
<input type="text" />
</div>
<div class="cell">
<input type="text" />
</div>
</div>
</section>
<section id="row2" class="container" style="transform:translate3d(0px, 40px, 0px)">
<div class="row">
<div class="cell">
<input type="text" /><span class="toggle-dropdown icon">↓</span>
<ul class="element">
<li>element 1</li>
<li>element 2</li>
<li>element 3</li>
</ul>
</div>
<div class="cell">
<input type="text" />
</div>
<div class="cell">
<input type="text" />
</div>
</div>
</section>
<section id="row3" class="container" style="transform:translate3d(0px, 80px, 0px)">
<div class="row">
<div class="cell">
<input type="text" /><span class="toggle-dropdown icon">↓</span>
<ul class="element">
<li>element 1</li>
<li>element 2</li>
<li>element 3</li>
</ul>
</div>
<div class="cell">
<input type="text" />
</div>
<div class="cell">
<input type="text" />
</div>
</div>
</section>
<section id="row4" class="container" style="transform:translate3d(0px, 120px, 0px)">
<div class="row">
<div class="cell">
<input type="text" /><span class="toggle-dropdown icon">↓</span>
<ul class="element">
<li>element 1</li>
<li>element 2</li>
<li>element 3</li>
</ul>
</div>
<div class="cell">
<input type="text" />
</div>
<div class="cell">
<input type="text" />
</div>
</div>
</section>
</section>
</body>
</html>
Related
I'm trying to make a multi-level accordion for a navigational aside in a page, and I'm finding that one type of element comes out too long: when changing the background-color on a hover, the highlighted background of that one extends into the main body of the page. This happens for a folder-type item (with child elements) that is itself a child of another folder.
In the JSFiddle here, the problem is seen when comparing "Folder 3" to everything else. How do I get it to match?
.accordion {
list-style: none;
margin: 0;
padding: 0;
}
aside {
background-color: orange;
flex: 1;
flex-direction: column;
left: 0;
margin-left: 20px;
margin-right: 20px;
position: absolute;
width: 150px;
z-index: 1;
}
.container {
display: flex;
position: relative;
}
.input {
position: absolute;
opacity: 0;
}
.label {
display: inline-block;
width: 100%;
}
.label:hover,
.item:not(.has-children):hover {
background-color: red;
}
.label-l1 {
padding-left: 20px;
}
.label-l2 {
padding-left: 40px;
}
.main {
background-color: yellow;
flex: 1;
flex-direction: column;
margin-left: 170px;
width: 200px;
}
.sub {
display: none;
list-style: none;
margin-left: 0;
padding-left: 0;
width: 100%;
}
.input:checked~.sub {
display: block;
}
<html>
<body>
<div class="container">
<aside>
<ul class="accordion">
<li class="item has-children">
<input class="input" type="checkbox" name="c1" id="c1">
<label class="label" for="c1"><span>Folder 1</span></label>
<ul class="sub sub-l1">
<li class="item">Item 1</li>
<li class="item">Item 2</li>
</ul>
</li>
<li class="item has-children">
<input class="input" type="checkbox" name="c2" id="c2">
<label class="label" for="c2"><span>Folder 2</span></label>
<ul class="sub sub-l1">
<li class="item has-children">
<input class="input" type="checkbox" name="c3" id="c3">
<label class="label label-l1" for="c3"><span>Folder 3</span></label>
<ul class="sub sub-l1">
<li class="item">Item 3</li>
<li class="item">Item 4</li>
</ul>
</li>
</ul>
</li>
</ul>
</aside>
<div class="main">
<p>I must speak my mind about this.</p>
</div>
</div>
</body>
</html>
Your issue is the parent element has a width of 100%, and the element has a padding of 20px, this is pushing the right side margin 20px past the right border, add box-sizing: border-box; to .label-l1 element, this will constrain any would be overflow inside the border and keep the background from overflowing outside the border.
.label-l1 {
padding-left: 20px;
box-sizing: border-box;
}
Note: You can set this in a reset within your CSS so you do not have to fix all potential occurrences with border-sizing on other elements
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.accordion {
list-style: none;
margin: 0;
padding: 0;
}
aside {
background-color: orange;
flex: 1;
flex-direction: column;
left: 0;
margin-left: 20px;
margin-right: 20px;
position: absolute;
width: 150px;
z-index: 1;
}
.container {
display: flex;
position: relative;
}
.input {
position: absolute;
opacity: 0;
}
.label {
display: inline-block;
width: 100%;
}
.label:hover, .item:not(.has-children):hover {
background-color: red;
}
.label-l1 {
padding-left: 20px;
box-sizing: border-box; /* added this line of code */
}
.label-l2 {
padding-left: 40px;
}
.main {
background-color: yellow;
flex: 1;
flex-direction: column;
margin-left: 170px;
width: 200px;
}
.sub {
display: none;
list-style: none;
margin-left: 0;
padding-left: 0;
width: 100%;
}
.input:checked ~ .sub {
display: block;
}
<div class="container">
<aside>
<ul class="accordion">
<li class="item has-children">
<input class="input" type="checkbox" name="c1" id="c1">
<label class="label" for="c1"><span>Folder 1</span></label>
<ul class="sub sub-l1">
<li class="item">Item 1</li>
<li class="item">Item 2</li>
</ul>
</li>
<li class="item has-children">
<input class="input" type="checkbox" name="c2" id="c2">
<label class="label" for="c2"><span>Folder 2</span></label>
<ul class="sub sub-l1">
<li class="item has-children">
<input class="input" type="checkbox" name="c3" id="c3">
<label class="label label-l1" for="c3"><span>Folder 3</span></label>
<ul class="sub sub-l1">
<li class="item">Item 3</li>
<li class="item">Item 4</li>
</ul>
</li>
</ul>
</li>
</ul>
</aside>
<div class="main">
<p>I must speak my mind about this.</p>
</div>
</div>
I have a scrolling div contain a ul in react.
When the number of liincreased, the division should scroll horizontally.
this is my code:
<div className="inner-scrolling">
<ul className="list">
<li> item</li>
...
</ul>
</div>
this is css:
.inner-scrolling {
width: 100%;
max-width: 0;
overflow-x: auto;
}
.list {
list-style: none;
display: inline-flex;
}
This is working correctly in Chrome but not working in Firefox. How can I fix it?
I tried max-width:500px but it doesn't work in Firefox yet. actually in Firefox, lis move out of the div.
You can just add display: flex, overflow-y: hidden and overflow-x: scroll to the <ul> container.
You will also need extra containers for it to be able to work in Firefox and Safari.
All the child elements will be in a row, horizontally scrollable.
Snippet:
* {
list-style: none;
margin: 0;
padding: 0;
}
.container {
max-width: 100%;
margin: 0 auto;
}
.scrolling-container {
width: 100%;
overflow-x: auto;
display: flex;
}
.list {
display: flex;
}
img {
max-height: 150px;
width: 300px;
object-fit: cover;
}
img:not(:first-child) {
margin-left: 10px;
}
<div class="container">
<div class="scrolling-container">
<div class="list">
<img src="https://www.cowgirlcontractcleaning.com/wp-content/uploads/sites/360/2018/05/placeholder-img.jpg" alt="" />
<img src="https://www.cowgirlcontractcleaning.com/wp-content/uploads/sites/360/2018/05/placeholder-img.jpg" alt="" />
<img src="https://www.cowgirlcontractcleaning.com/wp-content/uploads/sites/360/2018/05/placeholder-img.jpg" alt="" />
<img src="https://www.cowgirlcontractcleaning.com/wp-content/uploads/sites/360/2018/05/placeholder-img.jpg" alt="" />
<img src="https://www.cowgirlcontractcleaning.com/wp-content/uploads/sites/360/2018/05/placeholder-img.jpg" alt="" />
<img src="https://www.cowgirlcontractcleaning.com/wp-content/uploads/sites/360/2018/05/placeholder-img.jpg" alt="" />
</div>
</div>
</div>
You can try this code. There are multiple corrections/additions I have done in the code below.
.outerDiv {
max-width: 500px;
margin: 0 auto;
}
.inner-scrolling {
width: 100%;
overflow-x: auto;
display: flex;
}
.list {
width: 100%;
list-style: none;
display: flex;
flex-wrap: nowrap;
margin: 0;
padding: 0;
}
.list li {
width: 100px; /* Temporary width is given you can remove it later on. */
display: inline-block;
padding: 10px 20px;
}
<div class="outerDiv">
<div class="inner-scrolling">
<ul class="list">
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
<li>item 4</li>
<li>item 5</li>
<li>item 6</li>
<li>item 7</li>
<li>item 8</li>
<li>item 9</li>
<li>item 10</li>
</ul>
</div>
</div>
Currently working on a cursor that shows text in a div when hovering over it and hides the rest of the div with box-shadow. My problem is that the box-shadow is covering my whole page and I only want to cover the div where the text is showed.
I've tried fixing this with z-index but I think it's not a good idea to give every element a position with a z-index. So I've been trying to use position relative which doens't hide the rest of the page but then it won't be showing the text when hovering on it.
It's suppose to do this when hovering over it with the cursor with out covering the rest like the second picture
But then it won't show the text when I put in position: relative; in .test
.container .pageBlock .googleBlock {
width: 1100px;
margin: 0 auto;
padding: 0 30px;
max-width: 100%;
box-sizing: border-box;
cursor: url(../img/vergrootglas.png) 55 30, auto;
}
.container .pageBlock .googleBlock .title {
font-size: 14px;
font-weight: 200;
margin-left: 40px;
}
.container .pageBlock .googleBlock .test {
overflow: hidden;
position: relative;
}
.container .pageBlock .googleBlock .test .cursor {
position: absolute;
z-index: 1;
background: transparent;
width: 35px;
height: 35px;
opacity: 0.9;
border-radius: 50%;
box-shadow: 0 0 0 9999px #2D2D2D;
}
.container .pageBlock .googleBlock .test #maskOverlay {
width: 100%;
height: 100%;
}
.container .pageBlock .googleBlock .test .wrapper {
list-style: none;
display: inline-block;
width: 33%;
position: relative;
}
.container .pageBlock .googleBlock .test .wrapper .list ul {
list-style: none;
}
.container .pageBlock .googleBlock .test .wrapper .list ul > li:before {
content: "- ";
}
.container .pageBlock .googleBlock .test .wrapper .list li {
line-height: 28px;
}
<section class="googleBlock">
<h1 class='title'>Oh ja, en voor <strong>Google</strong>, voor als je mee leest...</h1>
<div class="test">
<div id="maskOverlay">
<div class="wrapper">
<div class="list">
<ul>
<li>Website laten maken</li>
<li>Online marketing bureau</li>
<li>Website maker</li>
<li>Website bouwen</li>
<li>Webdesign</li>
<li>Digital agency</li>
<li>Websites</li>
</ul>
</div>
</div>
<div class="wrapper">
<div class="list">
<ul>
<li>Grafisch ontwerper</li>
<li>Serious Game</li>
<li>Design bureau</li>
<li>Grafisch vormgever</li>
<li>Interactief</li>
<li>Kwaliteit</li>
<li>Interactieve communicatie</li>
</ul>
</div>
</div>
<div class="wrapper">
<div class="list">
<ul>
<li>Digital awesomeness</li>
<li>Custom website</li>
<li>Gaming</li>
<li>Technologie</li>
<li>Strategie</li>
<li>Branding</li>
<li>Digitale campagnes</li>
</ul>
</div>
</div>
</div>
<div class="cursor"></div>
</div>
</section>
Is it something like this you want?
.list:hover {
background-color: grey;
}
.points:hover {
color: white;
}
<section class="googleBlock">
<h1 class='title'>Oh ja, en voor <strong>Google</strong>, voor als je mee leest...</h1>
<div class="test">
<div id="maskOverlay">
<div class="wrapper">
<div class="list">
<ul>
<li class="points">Website laten maken</li>
<li class="points">Online marketing bureau</li>
<li class="points">Website maker</li>
<li class="points">Website bouwen</li>
<li class="points">Webdesign</li>
<li class="points">Digital agency</li>
<li class="points">Websites</li>
</ul>
</div>
</div>
<div class="wrapper">
<div class="list">
<ul>
<li class="points">Grafisch ontwerper</li>
<li class="points">Serious Game</li>
<li class="points">Design bureau</li>
<li class="points">Grafisch vormgever</li>
<li class="points">Interactief</li>
<li class="points">Kwaliteit</li>
<li class="points">Interactieve communicatie</li>
</ul>
</div>
</div>
<div class="wrapper">
<div class="list">
<ul>
<li class="points">Digital awesomeness</li>
<li class="points">Custom website</li>
<li class="points">Gaming</li>
<li class="points">Technologie</li>
<li class="points">Strategie</li>
<li class="points">Branding</li>
<li class="points">Digitale campagnes</li>
</ul>
</div>
</div>
</div>
<div class="cursor"></div>
</div>
</section>
This should do the trick
.container .pageBlock .googleBlock {
width: 1100px;
margin: 0 auto;
padding: 0 30px;
max-width: 100%;
box-sizing: border-box;
cursor: url(../img/vergrootglas.png) 55 30, auto;
}
.container .pageBlock .googleBlock .title {
font-size: 14px;
font-weight: 200;
margin-left: 40px;
}
.container .pageBlock .googleBlock .test {
overflow: hidden;
position: relative;
}
.container .pageBlock .googleBlock .test .cursor {
position: absolute;
z-index: 1;
background: transparent;
width: 35px;
height: 35px;
opacity: 0.9;
border-radius: 50%;
box-shadow: 0 0 0 9999px #2D2D2D;
}
.container .pageBlock .googleBlock .test #maskOverlay {
width: 100%;
height: 100%;
}
.container .pageBlock .googleBlock .test .wrapper {
list-style: none;
display: inline-block;
width: 33%;
position: relative;
}
.container .pageBlock .googleBlock .test .wrapper .list ul {
list-style: none;
}
.container .pageBlock .googleBlock .test .wrapper .list ul > li:before {
content: "- ";
}
.container .pageBlock .googleBlock .test .wrapper .list li {
line-height: 28px;
}
.list{
transition: all 1s ease;
}
.list:hover{
box-shadow: 0 0 0 9999px #2D2D2D;
}
<section class="googleBlock">
<h1 class='title'>Oh ja, en voor <strong>Google</strong>, voor als je mee leest...</h1>
<div class="test">
<div id="maskOverlay">
<div class="wrapper">
<div class="list">
<ul>
<li>Website laten maken</li>
<li>Online marketing bureau</li>
<li>Website maker</li>
<li>Website bouwen</li>
<li>Webdesign</li>
<li>Digital agency</li>
<li>Websites</li>
</ul>
</div>
</div>
<div class="wrapper">
<div class="list">
<ul>
<li>Grafisch ontwerper</li>
<li>Serious Game</li>
<li>Design bureau</li>
<li>Grafisch vormgever</li>
<li>Interactief</li>
<li>Kwaliteit</li>
<li>Interactieve communicatie</li>
</ul>
</div>
</div>
<div class="wrapper">
<div class="list">
<ul>
<li>Digital awesomeness</li>
<li>Custom website</li>
<li>Gaming</li>
<li>Technologie</li>
<li>Strategie</li>
<li>Branding</li>
<li>Digitale campagnes</li>
</ul>
</div>
</div>
</div>
<div class="cursor"></div>
</div>
</section>
.list{
transition: all 1s ease;
}
.list:hover{
box-shadow: 0 0 0 9999px #2D2D2D;
}
I'm working on a landing page.
In the third section, I will have content with a horizontal scroll bar. I already have the desired scrolling behavior, but I'd like the scroll bar to respect the container of the page.
Here's my current code:
.page {
overflow: hidden;
}
.container {
width: 60%;
margin: auto;
}
h3 {
background: #dbd0bc;
color: #000;
padding: 1rem;
}
.hs {
list-style: none;
overflow-x: auto;
overflow-y: hidden;
white-space: nowrap;
width: 100%;
padding: 0 20% 2rem 20%;
}
.hs .item {
display: inline-block;
width: 17rem;
background: #dbd0bc;
text-align: center;
margin-right: 0.75rem;
height: 10rem;
white-space: normal;
}
::-webkit-scrollbar {
height: 15px;
}
::-webkit-scrollbar-track-piece {
background-color: gray;
}
::-webkit-scrollbar-thumb:horizontal {
background-color: red;
border-radius: 2rem;
}
<div class="page">
<div class="container">
<h3>Section 1</h3>
</div>
<div class="container">
<h3>Section 2</h3>
</div>
<ul class="hs">
<li class="item">section 3</li>
<li class="item">section 3</li>
<li class="item">section 3</li>
<li class="item">section 3</li>
<li class="item">section 3</li>
<li class="item">section 3</li>
<li class="item">section 3</li>
<li class="item">section 3</li>
</ul>
<div class="container">
<h3>Section 4</h3>
</div>
</div>
Here are two examples of what I'd like this to be like:
https://prnt.sc/n0o0k7
https://prnt.sc/n0o21r
I'm not really sure I understand the question. The third section wouldn't be styled correctly in the container because you didn't wrap it in the container. I moved the container class's styles to the page class's style and removed all the containers to achieve your desired effect.
.page {
overflow: hidden;
width: 60%;
margin: auto;
}
h3 {
background: #dbd0bc;
color: #000;
padding: 1rem;
}
.hs {
list-style: none;
overflow-x: auto;
overflow-y: hidden;
white-space: nowrap;
width: 100%;
padding: 0 20% 2rem 20%;
}
.hs .item {
display: inline-block;
width: 17rem;
background: #dbd0bc;
text-align: center;
margin-right: 0.75rem;
height: 10rem;
white-space: normal;
}
::-webkit-scrollbar {
height: 15px;
}
::-webkit-scrollbar-track-piece {
background-color: gray;
}
::-webkit-scrollbar-thumb:horizontal {
background-color: red;
border-radius: 2rem;
}
<div class="page">
<h3>Section 1</h3>
<h3>Section 2</h3>
<ul class="hs">
<li class="item">section 3</li>
<li class="item">section 3</li>
<li class="item">section 3</li>
<li class="item">section 3</li>
<li class="item">section 3</li>
<li class="item">section 3</li>
<li class="item">section 3</li>
<li class="item">section 3</li>
</ul>
<h3>Section 4</h3>
</div>
http://jsfiddle.net/Dmb7v/ :
<body>
<div class="Shell">
<div class="Main">
<div class="Header">
<p>Name Surname</p>
<p>G123456789</p>
</div>
<div class="Content">
<p>VIEW NAVIGATION</p>
<ul>
<li>Menu Item 1</li>
<li>Menu Item 2</li>
<li>Menu Item 3</li>
<li>Menu Item 4</li>
<li>Menu Item 5</li>
<li>Menu Item 6</li>
<li>Menu Item 7</li>
<li>Menu Item 8</li>
<li>Menu Item 9</li>
<li>Menu Item 10</li>
</ul>
</div>
</div>
<div class="Pane">
<div>
<img src="http://findicons.com/files/icons/2711/free_icons_for_windows8_metro/128/beer.png" height="48px" width="48px">
</div>
<div>
<span class="PaneText">My Team's Requests / Managed by my direct reports / Processes Completed / Processes Completed / Processes Completed / Processes Completed</span>
</div>
</div>
</div>
</body>
And CSS:
* {
padding: 0;
margin : 0;
box-sizing: border-box;
}
html, body {
height: 100%;
}
.Shell {
height: 100%;
}
.Main {
width: 332px;
height: 100%;
background-color: #ffcccc;
border: 2px solid red;
float: left;
}
.Header {
width: 332px;
height: 56px;
background-color: #ccccff;
border: 2px solid blue;
}
.Content {
width: 332px;
background-color: #ccffcc;
border: 2px solid green;
}
.Pane {
height: 100%;
width: 48px;
background-color: #ffffcc;
border: 2px solid yellow;
overflow: visible;
float: left;
}
.PaneText {
-webkit-transform: rotate(90deg);
font-size: 30px;
white-space: nowrap;
display: block;
height: 100%;
width: 48px;
}
I've built a very basic menu on the left side of the screen. I will have text vertically run down the right side of the menu. The text is rendered in full but the DIV it's inside will not.
What am I doing wrong? I've found all sorts of suggestions but none work. Suggestions such as this:
html, body {
min-height:100%;
height:auto;
height:100%;
}
None of them worked. What am I doing wrong?