Skip to content

Instantly share code, notes, and snippets.

@zhentian-wan
Last active October 8, 2016 08:33
Show Gist options
  • Save zhentian-wan/616f83e1298916d14a97d876064e9740 to your computer and use it in GitHub Desktop.
Save zhentian-wan/616f83e1298916d14a97d876064e9740 to your computer and use it in GitHub Desktop.
CSS calc
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>GistRun</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<nav>
nav
</nav>
<main>
main
</main>
<aside>
aside
</aside>
<script src="script.js"></script>
</body>
</html>
console.log('Hello World!');
nav{
background: yellow;
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 5rem;
}
main{
background: red;
width: calc(100% - 25rem);
margin-left: 5rem;
}
aside{
background: blue;
width: 20rem;
position: fixed;
top: 0;
right: 0;
height: 100%;
}
@media (max-width: 600px){
aside{
width: 8rem;
}
nav{
width: 3rem;
}
main{
width: calc(100%-11rem);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment