-
-
Save yamatt/884cbd16373c9b4b0162b9c9d4e11aa2 to your computer and use it in GitHub Desktop.
Responsive, resizable panel layout with flexbox JUST CSS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
box-sizing: border-box; | |
} | |
html, body { | |
height: 100%; | |
padding: 0; | |
margin: 0; | |
} | |
.container { | |
height: 100%; | |
position:relative; | |
} | |
.split { | |
display: flex; | |
height: 100%; | |
} | |
.split > :nth-child(1) { | |
overflow: auto; | |
} | |
.split > :nth-child(2) { | |
flex-grow: 1; | |
} | |
/* Vertical */ | |
.split.vertical { | |
flex-direction: column; | |
} | |
.split.vertical > :nth-child(1) { | |
resize: vertical; | |
} | |
/* Horizontal */ | |
.split.horizontal { | |
flex-direction: row; | |
} | |
.split.horizontal > :nth-child(1) { | |
resize: horizontal; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Split panels</title> | |
<link rel="stylesheet" href="split.css"> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="split horizontal"> | |
<div class="split vertical" style="width: 30em;"> | |
<div style="height: 20em; background-color: #f1a9a0"> </div> | |
<div style="background-color: #f1e7fe"> </div> | |
</div> | |
<div style="background-color: #fff9de"> </div> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Demo of this gist via gist.githack.com