I'm currently debugging a website to make it work on IE 11. Now there is one page, were there are two div tables inside a flexbox container. Under the container, there is another flexbox 'navLine', which should be positioned directly under the container. This works fine in every browser except IE 11. There the container and the navLine seem to overlap. Oddly enough, the navLine sticks to a button within the container. The button is within a cell of the div table, without any additional CSS properties.
Any help?
Here's the simplified code:
#NavLine
{
margin-bottom: 8px;
display: -webkit-flex;
display: -ms-flex;
display: flex;
justify-content: space-between;
align-items: center;
}
.SelectionBox
{
background: #f7f7f7;
border: 1px solid #d9d9d9;
padding: 16px;
margin-bottom: 16px;
min-width: 570px;
min-height: 410px;
}
.Container
{
display: -webkit-flex;
display: -ms-flex;
display: flex;
-webkit-justify-content: space-around;
-ms-justify-content: space-around;
justify-content: space-around;
width: 100%;
flex: 1 1 auto;
}
#Box1, #Box2
{
flex: 1 1 auto;
padding: 16px;
}
.Table
{
display: table;
table-layout: fixed;
overflow: hidden;
height: 100%;
width: 75%;
}
.Title
{
display: table-header-group;
width: 100%;
height: 80px;
}
.Row
{
display: table-row;
}
.Cell
{
display: table-cell;
padding-left: 5px;
padding-right: 5px;
vertical-align: middle;
height: 70px;
}
<div class="Container">
<!-- First Box -->
<div id="Box1">
<div class="Table SelectionBox">
<div class="Title">
<h2>Box One</h2>
</div>
<div class="Row">
<div class="Cell">
<span>Some Item</span>
</div>
<div class="Cell">
<span>Some Value</span>
</div>
</div>
<div class="Row">
<div class="Cell">
<span>Some Item</span>
</div>
<div class="Cell">
<span>Some Value</span>
</div>
</div>
<div class="Row">
<div class="Cell">
<span>Some Item</span>
</div>
<div class="Cell">
<span>Some Value</span>
</div>
</div>
<div class="Row">
<div class="Cell">
<span>Some Item</span>
</div>
<div class="Cell">
<span>Some Value</span>
</div>
</div>
<div class="Row">
<div class="Cell"></div>
<div class="Cell">
<span> ([[result]]) Results</span>
<span>Reset (this is a button)</span>
</div>
</div>
</div>
</div>
<!-- Second Box -->
<div id="Box2">
<div class="Table SelectionBox">
<div class="Title">
<h2>Box Two</h2>
</div>
<div class="Row">
<div class="Cell">
<span>Some Item</span>
</div>
<div class="Cell">
<span>Some Value</span>
</div>
</div>
<div class="Row">
<div class="Cell">
<span>Some Item</span>
</div>
<div class="Cell">
<span>Some Value</span>
</div>
</div>
<div class="Row">
<div class="Cell">
<span>Some Item</span>
</div>
<div class="Cell">
<span>Some Value</span>
</div>
</div>
<div class="Row">
<div class="Cell">
<span>Some Item</span>
</div>
<div class="Cell">
<span>Some Value</span>
</div>
</div>
<div class="Row">
<div class="Cell"></div>
<div class="Cell">
<span> ([[result]]) Results</span>
<span>Reset (this is a button)</span>
</div>
</div>
</div>
</div>
</div>
<div id="NavLine">
<span>Back</span>
<span>Next</span>
</div>
The problem in IE is that height: 100% in .Table.SelectionBox is causing that element to overflow its container (#Box1). It then overlaps the #NavLine element, which is not causing any problem.
One way to fix the problem is to remove that height rule.
"IE 11 requires a unit to be added to the third argument, the flex-basis property" - see "known issues" tab https://caniuse.com/#feat=flexbox
also, a min-height might be required
so, try for example:
#container > div {
flex:1 1 8em;
min-height:8em;
}
Related
I am trying to position the following elements one below the other , but one to the left and other to the right:
my code:
here is the fiddle: https://jsfiddle.net/ak9hxfpt/2/
I want to position the test2 to the right of the test1 div, but it should appear below the test1 div
What I want to achieve is something like: https://jsfiddle.net/ak9hxfpt/3/
however this works only for one div, if I try float: right for all the divs I have this is what I get which is not working out for me:
https://jsfiddle.net/ak9hxfpt/4/
the every "remove link" content should appear below every "some content".
any ideas on how this can be achieved
.test2 {
margin-bottom: 30px;
}
.test1 {
border: 1px solid #000;
margin-bottom: 10px;
width: 93%;
}
<div class="test2">
remove link
</div>
</div>
<div class="test">
<div class="test1">
some content
</div>
<div class="test2">
remove link
</div>
</div>
<div class="test">
<div class="test1">
some content
</div>
<div class="test2">
remove link
</div>
</div>
just add some margin-left
.test2 {
margin-bottom: 30px;
margin-left:80%;
}
.test1 {
border: 1px solid #000;
margin-bottom: 10px;
width: 93%;
}
<div class="test2">
remove link
</div>
<div class="test">
<div class="test1">
some content
</div>
<div class="test2">
remove link
</div>
</div>
<div class="test">
<div class="test1">
some content
</div>
<div class="test2">
remove link
</div>
</div>
or
.test2 {
margin-bottom: 30px;
width:93%;
text-align:right;
}
.test1 {
border: 1px solid #000;
margin-bottom: 10px;
width: 93%;
}
<div class="test">
<div class="test1">
some content
</div>
<div class="test2">
remove link
</div>
</div>
<div class="test">
<div class="test1">
some content
</div>
<div class="test2">
remove link
</div>
</div>
I would try nesting your code in a container and use display: flex; with flex-direction: column;
.test2 {
float: right;
}
.test1 {
border: 1px solid #000;
margin-bottom: 10px;
width: 93%;
}
.container {
display: flex;
flex-direction: column;
}
<div class="container">
<div class="test">
<div class="test1">
some content
</div>
<div class="test2">
remove link
</div>
</div>
<div class="test">
<div class="test1">
some content
</div>
<div class="test2">
remove link
</div>
</div>
<div class="test">
<div class="test1">
some content
</div>
<div class="test2">
remove link
</div>
</div>
<div class="test">
<div class="test1">
some content
</div>
<div class="test2">
remove link
</div>
</div>
<div class="test">
<div class="test1">
some content
</div>
<div class="test2">
remove link
</div>
</div>
</div>
Another option would be to set display: flex; on test right a flex-direction: row; then you can can set test2 to width: 7%; while test still takes up 93%. Finally, you can space them by adding gap Check the snippet below.
.test2 {
width: 7%;
}
.test1 {
border: 1px solid #000;
margin-bottom: 10px;
width: 93%;
}
.test {
display: flex;
flex-direction: row;
width: 100%;
gap: 10px;
}
<div class="test">
<div class="test1">
some content
</div>
<div class="test2">
remove link
</div>
</div>
<div class="test">
<div class="test1">
some content
</div>
<div class="test2">
remove link
</div>
</div>
<div class="test">
<div class="test1">
some content
</div>
<div class="test2">
remove link
</div>
</div>
<div class="test">
<div class="test1">
some content
</div>
<div class="test2">
remove link
</div>
</div>
<div class="test">
<div class="test1">
some content
</div>
<div class="test2">
remove link
</div>
</div>
Just add display: flex; justify-content: flex-end to your test2 class and it will work.enter image description here
I have a page where the left and right are split evenly. On the right side, I have a bunch of div elements containing an img and a span. What I'm trying to do is show four of these div elements at MOST per row, and start to wrap on smaller screens, with a specific gap.
The problem I'm having is the gap is wider on bigger screens, and the elements squish together on smaller screens instead of wrapping, regardless of what gap value I set.
Here's a gif showing what's happening: https://gfycat.com/remorsefulglossyherring
Here's the relevant HTML (only the right side of the page which contains these divs):
<div
class="about"
fxFlex="50%"
fxLayout="row wrap"
fxLayoutGap="10px grid"
fxLayoutAlign="center center"
>
<div fxFlex="25%" class="item">
<img class="img-skills" src="assets/c-sharp.png" alt="C#" />
<span class="caption">C#</span>
</div>
<div fxFlex="25%" class="item">
<img class="img-skills" src="assets/.net-core.png" alt=".NET Core" />
<span class="caption">.NET Core</span>
</div>
<div fxFlex="25%" class="item">
<img class="img-skills" src="assets/wpf.png" alt="WPF" />
<span class="caption">WPF</span>
</div>
<div fxFlex="25%" class="item">
<img class="img-skills" src="assets/winforms.jpg" alt="WinForms" />
<span class="caption">WinForms</span>
</div>
<div fxFlex="25%" class="item">
<img class="img-skills" src="assets/angular.png" alt="Angular" />
<span class="caption">Angular</span>
</div>
<div fxFlex="25%" class="item">
<img class="img-skills" src="assets/nodejs.png" alt="NodeJS" />
<span class="caption">Node.js</span>
</div>
<div fxFlex="25%" class="item">
<img class="img-skills" src="assets/html5.png" alt="HTML5" />
<span class="caption">HTML5</span>
</div>
<div fxFlex="25%" class="item">
<img class="img-skills" src="assets/css3.png" alt="CSS3" />
<span class="caption">CSS3</span>
</div>
<div fxFlex="25%" class="item">
<img class="img-skills" src="assets/mongodb.png" alt="MongoDB" />
<span class="caption">MongoDB</span>
</div>
<div fxFlex="25%" class="item">
<img
class="img-skills"
src="assets/mssql.png"
alt="Microsoft SQL Server"
/>
<span class="caption">Microsoft SQL Server</span>
</div>
</div>
Here's the css:
.about {
min-height: 100vh;
justify-content: center;
height: 100%;
}
div.item {
vertical-align: top;
display: inline-block;
text-align: center;
width: 120px;
}
.img-skills {
width: 100px;
height: 100px;
background-color: grey;
}
.caption {
display: block;
}
This is the simple idea, but this will help you for sure to start with:
Play around here : fiddle
.MainDiv {
border: 1px solid red;
display: flex;
flex-wrap: wrap;
}
.first {
border: 1px solid black;
height: 100px;
width: 100px;
background-color: gray;
margin: 5px;
}
<div class="MainDiv">
<div class="first"></div>
<div class="first"></div>
<div class="first"></div>
<div class="first"></div>
<div class="first"></div>
<div class="first"></div>
<div class="first"></div>
<div class="first"></div>
</div>
Make it both left and right divs separated with the main container.
Your right side div should be like this below.
<div fxLayout="row" fxLayoutGap="20px">
<div>1. One</div>
<div>2. Two</div>
<div>3. Three</div>
<div>4. Four</div>
</div>
I found strange case. when I use html like that :
<div class="card" style="display:inline-flex; overflow:hidden;">
<div style="display: block; width:10em; height: 5em;">
<div style="display:flex;">
<!-- here -->
<div style="padding-bottom: 10em;"></div>
</div>
</div>
</div>
The div padding-bottom:10em push out others div.card blow the div.card like the padding is some invisible part of the div.card
When I change the internal flex div to block div the bug disapear
It look like the internal flex as it own layout that breach out from the blok and the outer inline-flex
How I prevent that, and make the div with the padding cut out like normal content into overflow hidden element.
It can be I found new bug in chrome flex model ?
Live example :
https://uvzoo.csb.app/
Codesendbox: https://codesandbox.io/s/zen-engelbart-uvzoo
div {
outline: 1px solid pink;
padding: 0.5em;
margin: 0.3em;
}
<div style="display: block; width:30em; height: 40em; padding: 1em;">
<!-- block card -->
<div style="display:inline-flex; overflow:hidden;">
<div style="display: block; width:10em; height: 5em;">
<div style="display:flex;">
<div style="padding-bottom: 10em;"></div>
</div>
</div>
</div>
<!-- end block card -->
<!-- block card -->
<div style="display:inline-flex; overflow:hidden;">
<div style="display: block; width:10em; height: 5em;">
<div style="display:flex;">
<div style="padding-bottom: 10em;"></div>
</div>
</div>
</div>
<!-- end block card -->
<!-- block card -->
<div style="display:inline-flex; overflow:hidden;">
<div style="display: block; width:10em; height: 5em;">
<div style="display:flex;">
<div style="padding-bottom: 10em;"></div>
</div>
</div>
</div>
<!-- end block card -->
<!-- block card -->
<div style="display:inline-flex; overflow:hidden;">
<div style="display: block; width:10em; height: 5em;">
<div style="display:flex;">
<div style="padding-bottom: 10em;"></div>
</div>
</div>
</div>
<!-- end block card -->
<!-- block card -->
<div style="display:inline-flex; overflow:hidden;">
<div style="display: block; width:10em; height: 5em;">
<div style="display:flex;">
<div style="padding-bottom: 10em;"></div>
</div>
</div>
</div>
<!-- end block card -->
</div>
Adding vertical-align:top fixes the issue. I don't know exactly why but it seems there is a complex calculation that is affecting the baseline calculation of each box making it outside and far from the bottom. Since baseline is the default alignment, you are getting this strange result
div {
outline: 1px solid pink;
padding: 0.5em;
}
.box {
display: inline-flex;
vertical-align:top;
overflow: hidden;
}
.box>div {
display: block;
width: 10em;
height: 5em;
}
.box>div>div {
display: flex;
}
.box>div>div>div {
padding-bottom: 10em;
}
<div style="display: block; width:30em; height: 40em; padding: 1em;">
<!-- block card -->
<div class="box">
<div>
<div>
<div></div>
</div>
</div>
</div>
<div class="box">
<div>
<div>
<div></div>
</div>
</div>
</div>
<div class="box">
<div>
<div>
<div></div>
</div>
</div>
</div>
<div class="box">
<div>
<div>
<div></div>
</div>
</div>
</div>
</div>
If we add some text we can notice this:
div {
outline: 1px solid pink;
padding: 0.5em;
}
.box {
display: inline-flex;
overflow: hidden;
}
.box>div {
display: block;
width: 10em;
height: 5em;
}
.box>div>div {
display: flex;
}
.box>div>div>div {
padding-bottom: 10em;
}
<div style="display: block; padding: 1em;">
<!-- block card -->
<div class="box">
<div>
<div>
<div></div>
</div>
</div>
</div> some text here
<div class="box">
<div>
<div>
<div></div>
</div>
</div>
</div>
<div class="box">
<div>
<div>
<div></div>
</div>
</div>
</div>
</div> some text here
<div class="box">
<div>
<div>
<div></div>
</div>
</div>
</div>
</div>
I Have some problems with Bootstrap 4.
I Have activated flexbox and i want content in column to be 100% height.
This is the structure:
<div class="row">
<div class="col-md-6 col-xs-12">
<div class="content">
</div>
</div>
</div>
This is the result:
Flexbox
How can the gray background be 100% height? i tried with height: 100%. But the container will be 100% height of the page and not of the column. I also tried to set parent to relative and child to absolute. Doesn't worked.
Background color is set on content.
Codeexample:
http://jsfiddle.net/KjGZw/339/
You need to make the .col divs flex-containers with display:flex and apply flex-direction:column to those.
Then set the .content divs to flex:1
.row {
height: auto;
display: flex;
flex-wrap: wrap;
}
.col {
padding: 15px;
flex: 1 1 25%;
display: flex;
flex-direction: column;
}
.content {
background: purple;
color: white;
padding: 15px;
flex: 1;
}
*,
:after,
:before {
box-sizing: inherit;
}
<div class="row">
<div class="col">
<div class="content">
Test
<br />Test
<br />Test
<br />Test
<br />Test
<br />
</div>
</div>
<div class="col">
<div class="content">
Test
</div>
</div>
<div class="col">
<div class="content">
Test
</div>
</div>
<div class="col">
<div class="content">
Test
</div>
</div>
<div class="col">
<div class="content">
Test
<br>Test
<br>Test
<br>Test
<br>
</div>
</div>
<div class="col">
<div class="content">
Test
</div>
</div>
</div>
I am trying to display dynamic generated div's horizontally with scroll bar. There can be n number of div's.
Below is my Code:
HTML (index.html)
<div style="width:100%;float:left;" id="old">
<div>
<h1>First Div</h1>
<div id="R1">
<h1>First Div Internal</h1>
<a id="R1_index" class="close_page" href="javascript:void(0)">Close</a>
</div>
</div>
<div>
<h1>Second Div</h1>
<div id="R2">
<h1>Second Div Internal</h1>
<a id="R2_index" class="close_page" href="javascript:void(0)">Close</a>
</div>
</div>
</div>
I follow this link for solution.
But when dynamic div's load, structure looked messed up.
Here is the messy look:
HTML (index.html)
<div style="width:100%;float:left;" id="old">
<div id="items">Missing Internal Content</div>
<div id="items">Missing Internal Content</div>
</div>
Please help me guys.
i imagin the problem is that the div's in the container (id="old" in your example) are not next to each other, but instead beneath.
if that is your problem, you add the following styles to your container:
#old {
overflow: auto;
white-space: nowrap;
}
and make the childern-divs inline-block elements:
#old > div {
display: inline-block;
}
then it should work as expected. see the working solution:
* {
padding: 0;
margin:0;
}
#container {
width: 300px;
height: 100px;
overflow: auto;
white-space: nowrap;
}
.element {
display: inline-block;
}
.box {
width: 100px;
height: 100px;
background: lightgrey;
}
<div id="container">
<div class="element">
<div class="box">
<h1>1</h1>
</div>
</div>
<div class="element">
<div class="box">
<h1>2</h1>
</div>
</div>
<div class="element">
<div class="box">
<h1>3</h1>
</div>
</div>
<div class="element">
<div class="box">
<h1>4</h1>
</div>
</div>
<div class="element">
<div class="box">
<h1>5</h1>
</div>
</div>
<div class="element">
<div class="box">
<h1>6</h1>
</div>
</div>
<div class="element">
<div class="box">
<h1>7</h1>
</div>
</div>
<div class="element">
<div class="box">
<h1>8</h1>
</div>
</div>
</div>
otherwise please provide a better example/description of what the problem exactly is.