Skip to content
This repository was archived by the owner on Mar 16, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 12 additions & 27 deletions flex/index.html
Original file line number Diff line number Diff line change
@@ -1,37 +1,22 @@
<!DOCTYPE html>
<html>

<head>
<title>Flex Basis</title>
<link href='style.css' rel='stylesheet' />
<title>Flex</title>
<link rel='stylesheet' href='style.css' />
<link href='https://fonts.googleapis.com/css?family=Roboto+Mono' rel='stylesheet'>
</head>

<body>
<h1>Grows</h1>
<div id='grows'>
<div class='grow side'>
<h2>1</h2>
</div>
<div class='grow center'>
<h2>2</h2>
</div>
<div class='grow side'>
<h2>3</h2>
</div>
<h1>Top</h1>
<div class='container' id='top'>
<div class='side'></div>
<div class='center'></div>
<div class='side'></div>
</div>
<h1>Shrinks</h1>
<div id='shrinks'>
<div class='shrink side'>
<h2>1</h2>
</div>
<div class='shrink center'>
<h2>2</h2>
</div>
<div class='shrink side'>
<h2>3</h2>
</div>
<h1>Bottom</h1>
<div class='container' id='bottom'>
<div class='side'></div>
<div class='center'></div>
<div class='side'></div>
</div>
</body>

</html>
54 changes: 26 additions & 28 deletions flex/style.css
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@
body {
margin: 0;
border: 0;
margin: 0 15px;
font-family: 'Roboto Mono', monospace;
}

h1 {
text-align: center;
display: block;
font-size: 18px;
}

h2 {
text-align: center;
font-size: 16px;
.container {
height: 150px;
width: 100%;
display: flex;
background-color: whitesmoke;
}

.grow,
.shrink {
width: 100px;
height: 100px;
.side,
.center {
height: 75px;
background-color: dodgerblue;
border: 2px solid lightgrey;
margin: 10px 30px;
}

.grow.side {
flex-basis: 60px;
flex-grow: 1;
border: 1px solid lightgrey;
display: inline-block;
}

.grow.center {
flex-grow: 3;
#top .side {
flex-grow: 2;
flex-shrink: 2;
flex-basis: 100px;
}

.shrink.side {
flex-basis: 300px;
#top .center {
flex-grow: 1;
flex-shrink: 3;
flex-basis: 50px;
}

.shrink.center {
#bottom .side {
flex-grow: 1;
flex-shrink: 2;
flex-basis: 150px;
flex-basis: 75px;
}

#grows,
#shrinks {
display: flex;
background-color: whitesmoke;
justify-content: center;
min-height: 200px;
align-items: center;
#bottom .center {
flex-grow: 2;
flex-shrink: 1;
flex-basis: 100px;
}