Skip to content

Instantly share code, notes, and snippets.

@ingdir
Created August 15, 2013 19:43
Show Gist options
  • Save ingdir/6244108 to your computer and use it in GitHub Desktop.
Save ingdir/6244108 to your computer and use it in GitHub Desktop.
flexible flyout
<!DOCTYPE html>
<html>
<head>
<style>
body {
margin: 0;
padding: 0;
}
.dm-flyout {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom:0;
background-color: rgba(0,0,0,.5);
}
.dm-flyout__container {
position: absolute;
top: 10%;
bottom: 10%;
left: 10%;
right: 10%;
overflow: hidden;
box-shadow: 0 0 15px #000;
background-color: #fff;
}
.dm-flyout__title {
font: normal 21px Arial, sans-serif;
box-sizing: border-box;
width: 100%;
height: 50px;
line-height: 50px;
white-space: nowrap;
color: #b2110d;
}
.dm-flyout__content {
box-sizing: border-box;
width: 100%;
height: -moz-calc(100% - 50px);
height: -webkit-calc(100% - 50px);
height: calc(100% - 50px);
overflow: auto;
background-color: yellow;
}
@media screen and (min-width: 1200px) {
.dm-flyout__container {
width: 960px;
left: -moz-calc((100% - 960px) / 2);
right: -moz-calc((100% - 960px) / 2);
left: -webkit-calc((100% - 960px) / 2);
right: -webkit-calc((100% - 960px) / 2);
left: calc((100% - 960px) / 2);
right: calc((100% - 960px) / 2);
}
}
@media screen and (min-height: 600px) {
.dm-flyout__container {
height: 500px;
top: -moz-calc((100% - 500px) / 2);
bottom: -moz-calc((100% - 500px) / 2);
top: -webkit-calc((100% - 500px) / 2);
bottom: -webkit-calc((100% - 500px) / 2);
top: calc((100% - 500px) / 2);
bottom: calc((100% - 500px) / 2);
}
}
.inner {
width: 2000px;
height: 300px;
background-color: red;
}
</style>
</head>
<body>
<div class="dm-flyout">
<div class="dm-flyout__container">
<div class="dm-flyout__title">Hello moto</div>
<div class="dm-flyout__content">
<div class="inner"></div>
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment