Skip to content

Instantly share code, notes, and snippets.

@michael
Created August 8, 2017 13:06
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 michael/7e1442fc8366102108b79d5e6d2698b4 to your computer and use it in GitHub Desktop.
Save michael/7e1442fc8366102108b79d5e6d2698b4 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Spreadsheet Layout with Flexbox</title>
<meta charset="UTF-8">
<style>
body {
overflow: hidden;
}
/* apply a natural box layout model to all elements, but allowing components to change */
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
.row {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
}
.cell.highlighted {
/*overflow: visible;*/
/*flex: 0 0 auto;*/
background: green;
}
.cell.empty {
}
.cell {
flex: 0 0 auto;
display: flex;
width: 100px;
white-space: nowrap;
overflow: visible;
}
</style>
</head>
<body>
<div class="spreadsheet">
<div class="row">
<div class="cell highlighted" style="width: 300px;">
<div class="cell-content">HelloasdfsdFJ ALKSDJF LAKSDJF</div>
</div>
<!-- <div class="cell empty" style="width: 200px;"></div> -->
<div class="cell" style="width: 300px;">
<div class="cell-content">Mehasd</div>
</div>
</div>
<div class="row">
<div class="cell" style="width: 100px;">Hello</div>
<div class="cell" style="width: 200px;">World</div>
<div class="cell" style="width: 300px;">Meh</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment