Skip to content

Instantly share code, notes, and snippets.

@rastersysteme
Created August 26, 2014 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rastersysteme/0cf5d649f81cf1d5575a to your computer and use it in GitHub Desktop.
Save rastersysteme/0cf5d649f81cf1d5575a to your computer and use it in GitHub Desktop.
Flexbox Equal Height Testcase
/**
* Flexbox Equal Height Testcase
*
*/
/**
* ---------------------------------------------------------------------------------------------------- #
*
* Browser Reset
*
*/
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
font,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
margin: 0;
border: 0;
padding: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
main,
menu,
nav,
section,
summary {
display: block;
}
audio,
canvas,
progress,
video {
display: inline-block;
vertical-align: baseline;
}
audio:not([controls]) {
display: none;
height: 0;
}
body {
line-height: 1;
}
blockquote,
q {
quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
content: none;
}
img {
border: 0;
}
ol,
ul {
list-style: none;
}
pre {
overflow: auto;
}
svg:not(:root) {
overflow: hidden;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/**
* ---------------------------------------------------------------------------------------------------- #
*
* Basic Formattings
*
*/
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body {
font-family: helvetica, arial, sans-serif;
font-size: 1em; /* 16px */
line-height: 1.375em; /* 22px */
text-align: left;
text-rendering: optimizeLegibility;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
color: #333;
background-color: #fff;
}
/**
* ---------------------------------------------------------------------------------------------------- #
*
* Page
*
*/
.b-page {
position: relative;
max-width: 1280px;
margin: 0 auto;
}
/**
* ---------------------------------------------------------------------------------------------------- #
*
* Grid
*
*/
.b-grid {
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.b-grid.is-level-1 {
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
}
.b-grid.is-level-2 {
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
.b-grid .cell {
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
.b-grid.is-level-1 > .cell {
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
padding: 20px;
}
.b-grid.is-level-1 > .cell:nth-child(1) {
background-color: #eee;
}
.b-grid.is-level-1 > .cell:nth-child(2) {
background-color: #ccc;
}
.b-grid.is-level-2 > .cell:nth-child(1) {
min-height: 44px;
margin-bottom: 22px;
}
.b-grid.is-level-2 > .cell:nth-child(2) {
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
padding: 20px;
background-color: #aaa;
}
.b-grid .list {
list-style: disc inside;
}
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=IE7" />
<title>Flexbox Equal Height Testcase</title>
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="flexbox.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="b-page">
<div class="b-grid is-level-1">
<div class="cell">
<div class="b-grid is-level-2">
<div class="cell">
<h2 class="title">headline headline headline headline headline headline headline headline headline headline headline headline headline headline</h2>
</div>
<div class="cell">
<ul class="list">
<li>listitem</li>
<li>listitem</li>
<li>listitem</li>
<li>listitem</li>
<li>listitem</li>
<li>listitem</li>
<li>listitem</li>
<li>listitem</li>
<li>listitem</li>
</ul>
</div>
</div>
</div>
<div class="cell">
<div class="b-grid is-level-2">
<div class="cell">
<h2 class="title">headline</h2>
</div>
<div class="cell">
<ul class="list">
<li>listitem</li>
<li>listitem</li>
<li>listitem</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment