I build a treeview with Flexboxes, but I can't get the layout to work in Chrome. The overflow doesn't work and destroys the layout.
In Firefox/IE/Edge the code snippet below works as I want it to with overflow.
Screen of it working in Firefox:
But in Chrome it displays it as it is in the code snippet here. How can I get the overflow to work like it does in FF/IE ?
/* WorkPackage Treeview */
.flex-tree,
.flex-tree2,
.flex-tree-content,
.flex-tree-content2,
.flex-tree-bottom,
.flex-tree-parent,
.flex-tree-children,
.flex-tree-child-button {
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
.flex-tree,
.flex-tree2,
.flex-tree-content,
.flex-tree-content2,
.flex-tree-parent {
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
.flex-tree {
min-width: 240px;
max-width: 245px;
min-height: 180px;
max-height: 180px;
position: absolute;
border-style: solid;
border-width: 1px;
z-index: 100;
}
.flex-tree2 {
min-width: 240px;
max-width: 245px;
min-height: 380px;
max-height: 380px;
position: absolute;
border-style: solid;
border-width: 1px;
z-index: 100;
}
.flex-tree-content {
min-height: 150px;
max-height: 150px;
background-color: White;
border-bottom-style: solid;
border-bottom-width: 1px;
overflow-y: scroll;
}
.flex-tree-content2 {
min-height: 350px;
max-height: 350px;
background-color: White;
border-bottom-style: solid;
border-bottom-width: 1px;
overflow-y: scroll;
}
.flex-tree-bottom {
align-items: center;
justify-content: center;
min-height: 30px;
max-height: 32px;
background-color: Gray;
border-bottom-style: solid;
border-bottom-width: 1px;
}
.flex-tree-parent {
margin-left: 20px;
}
.flex-tree-parent>.flex-tree-children:first-child {
margin-left: 7px;
}
.flex-tree-children {
-webkit-flex-direction: row-reverse;
-ms-flex-direction: row-reverse;
flex-direction: row-reverse;
margin: 3px;
margin-left: 27px;
min-width: 101px;
max-width: 101px;
min-height: 20px;
min-height: 20px;
}
.flex-tree-content>.flex-tree-children:first-child {
margin-top: 15px;
margin-left: 7px;
}
.flex-tree-content2>.flex-tree-children:first-child {
margin-top: 15px;
margin-left: 7px;
}
.flex-tree-child-button {
width: 16px;
height: 16px;
background-image: url('https://cdn2.iconfinder.com/data/icons/bwpx/icons/toggle_minus.gif');
background-repeat: no-repeat;
cursor: pointer;
order: 2;
}
.flex-tree-child {
text-align: center;
width: 80px;
height: 20px;
background-color: GreenYellow;
border-style: solid;
border-width: 1px;
color: black;
margin-left: 5px;
order: 1;
}
.flex-tree-close {
line-height: 7px;
width: 75px;
height: 25px;
cursor: pointer;
margin: 3px;
}
<div class="flex-tree" style="left: 50px; top: 50px;">
<div class="flex-tree-content">
<div class="flex-tree-children" id="2">
<div class="flex-tree-child-button" id="2"></div><a class="flex-tree-child" id="2">1</a></div>
<div class="flex-tree-children" id="6"><a class="flex-tree-child" id="6">1,1</a></div>
<div class="flex-tree-parent" id="8">
<div class="flex-tree-children" id="8">
<div class="flex-tree-child-button" id="8"></div><a class="flex-tree-child" id="8">1,2</a></div>
<div class="flex-tree-parent" id="19">
<div class="flex-tree-children" id="19">
<div class="flex-tree-child-button" id="19"></div><a class="flex-tree-child" id="19">1,2,1</a></div>
<div class="flex-tree-children" id="26">
<a class="flex-tree-child" id="26">1,2,1,1</a></div>
</div>
<div class="flex-tree-children" id="29"><a class="flex-tree-child" id="29">1,2,2</a></div>
<div class="flex-tree-children" id="30"><a class="flex-tree-child" id="30">1,2,3</a></div>
</div>
<div class="flex-tree-children" id="9"><a class="flex-tree-child" id="9">1,3</a></div>
<div class="flex-tree-children" id="23"><a class="flex-tree-child" id="23">1,4</a></div>
<div class="flex-tree-children" id="24"><a class="flex-tree-child" id="24">New task</a></div>
</div>
<div class="flex-tree-bottom">
<button class="flex-tree-close">Close</button>
</div>
</div>
<div class="flex-tree2" style="left: 400px; top: 50px;">
<div class="flex-tree-content2">
<div class="flex-tree-children" id="2">
<div class="flex-tree-child-button" id="2"></div><a class="flex-tree-child" id="2">1</a></div>
<div class="flex-tree-children" id="6"><a class="flex-tree-child" id="6">1,1</a></div>
<div class="flex-tree-parent" id="8">
<div class="flex-tree-children" id="8">
<div class="flex-tree-child-button" id="8"></div><a class="flex-tree-child" id="8">1,2</a></div>
<div class="flex-tree-parent" id="19">
<div class="flex-tree-children" id="19">
<div class="flex-tree-child-button" id="19"></div><a class="flex-tree-child" id="19">1,2,1</a></div>
<div class="flex-tree-children" id="26">
<a class="flex-tree-child" id="26">1,2,1,1</a></div>
</div>
<div class="flex-tree-children" id="29"><a class="flex-tree-child" id="29">1,2,2</a></div>
<div class="flex-tree-children" id="30"><a class="flex-tree-child" id="30">1,2,3</a></div>
</div>
<div class="flex-tree-children" id="9"><a class="flex-tree-child" id="9">1,3</a></div>
<div class="flex-tree-children" id="23"><a class="flex-tree-child" id="23">1,4</a></div>
<div class="flex-tree-children" id="24"><a class="flex-tree-child" id="24">New task</a></div>
</div>
<div class="flex-tree-bottom">
<button class="flex-tree-close">Close</button>
</div>
</div>
Use flex-shrink: 0
on .flex-tree-parent
/* WorkPackage Treeview */
.flex-tree,
.flex-tree2,
.flex-tree-content,
.flex-tree-content2,
.flex-tree-bottom,
.flex-tree-parent,
.flex-tree-children,
.flex-tree-child-button {
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
.flex-tree,
.flex-tree2,
.flex-tree-content,
.flex-tree-content2,
.flex-tree-parent {
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
.flex-tree {
min-width: 240px;
max-width: 245px;
min-height: 180px;
max-height: 180px;
position: absolute;
border-style: solid;
border-width: 1px;
z-index: 100;
}
.flex-tree2 {
min-width: 240px;
max-width: 245px;
min-height: 380px;
max-height: 380px;
position: absolute;
border-style: solid;
border-width: 1px;
z-index: 100;
}
.flex-tree-content {
min-height: 150px;
max-height: 150px;
background-color: White;
border-bottom-style: solid;
border-bottom-width: 1px;
overflow-y: scroll;
}
.flex-tree-content2 {
min-height: 350px;
max-height: 350px;
background-color: White;
border-bottom-style: solid;
border-bottom-width: 1px;
overflow-y: scroll;
}
.flex-tree-bottom {
align-items: center;
justify-content: center;
min-height: 30px;
max-height: 32px;
background-color: Gray;
border-bottom-style: solid;
border-bottom-width: 1px;
}
.flex-tree-parent {
margin-left: 20px;
flex-shrink: 0;
}
.flex-tree-parent>.flex-tree-children:first-child {
margin-left: 7px;
}
.flex-tree-children {
-webkit-flex-direction: row-reverse;
-ms-flex-direction: row-reverse;
flex-direction: row-reverse;
margin: 3px;
margin-left: 27px;
min-width: 101px;
max-width: 101px;
min-height: 20px;
min-height: 20px;
}
.flex-tree-content>.flex-tree-children:first-child {
margin-top: 15px;
margin-left: 7px;
}
.flex-tree-content2>.flex-tree-children:first-child {
margin-top: 15px;
margin-left: 7px;
}
.flex-tree-child-button {
width: 16px;
height: 16px;
background-image: url('https://cdn2.iconfinder.com/data/icons/bwpx/icons/toggle_minus.gif');
background-repeat: no-repeat;
cursor: pointer;
order: 2;
}
.flex-tree-child {
text-align: center;
width: 80px;
height: 20px;
background-color: GreenYellow;
border-style: solid;
border-width: 1px;
color: black;
margin-left: 5px;
order: 1;
}
.flex-tree-close {
line-height: 7px;
width: 75px;
height: 25px;
cursor: pointer;
margin: 3px;
}
<div class="flex-tree" style="left: 50px; top: 50px;">
<div class="flex-tree-content">
<div class="flex-tree-children" id="2">
<div class="flex-tree-child-button" id="2"></div><a class="flex-tree-child" id="2">1</a></div>
<div class="flex-tree-children" id="6"><a class="flex-tree-child" id="6">1,1</a></div>
<div class="flex-tree-parent" id="8">
<div class="flex-tree-children" id="8">
<div class="flex-tree-child-button" id="8"></div><a class="flex-tree-child" id="8">1,2</a></div>
<div class="flex-tree-parent" id="19">
<div class="flex-tree-children" id="19">
<div class="flex-tree-child-button" id="19"></div><a class="flex-tree-child" id="19">1,2,1</a></div>
<div class="flex-tree-children" id="26">
<a class="flex-tree-child" id="26">1,2,1,1</a></div>
</div>
<div class="flex-tree-children" id="29"><a class="flex-tree-child" id="29">1,2,2</a></div>
<div class="flex-tree-children" id="30"><a class="flex-tree-child" id="30">1,2,3</a></div>
</div>
<div class="flex-tree-children" id="9"><a class="flex-tree-child" id="9">1,3</a></div>
<div class="flex-tree-children" id="23"><a class="flex-tree-child" id="23">1,4</a></div>
<div class="flex-tree-children" id="24"><a class="flex-tree-child" id="24">New task</a></div>
</div>
<div class="flex-tree-bottom">
<button class="flex-tree-close">Close</button>
</div>
</div>
<div class="flex-tree2" style="left: 400px; top: 50px;">
<div class="flex-tree-content2">
<div class="flex-tree-children" id="2">
<div class="flex-tree-child-button" id="2"></div><a class="flex-tree-child" id="2">1</a></div>
<div class="flex-tree-children" id="6"><a class="flex-tree-child" id="6">1,1</a></div>
<div class="flex-tree-parent" id="8">
<div class="flex-tree-children" id="8">
<div class="flex-tree-child-button" id="8"></div><a class="flex-tree-child" id="8">1,2</a></div>
<div class="flex-tree-parent" id="19">
<div class="flex-tree-children" id="19">
<div class="flex-tree-child-button" id="19"></div><a class="flex-tree-child" id="19">1,2,1</a></div>
<div class="flex-tree-children" id="26">
<a class="flex-tree-child" id="26">1,2,1,1</a></div>
</div>
<div class="flex-tree-children" id="29"><a class="flex-tree-child" id="29">1,2,2</a></div>
<div class="flex-tree-children" id="30"><a class="flex-tree-child" id="30">1,2,3</a></div>
</div>
<div class="flex-tree-children" id="9"><a class="flex-tree-child" id="9">1,3</a></div>
<div class="flex-tree-children" id="23"><a class="flex-tree-child" id="23">1,4</a></div>
<div class="flex-tree-children" id="24"><a class="flex-tree-child" id="24">New task</a></div>
</div>
<div class="flex-tree-bottom">
<button class="flex-tree-close">Close</button>
</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With