<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<!DOCTYPE html><html class=''>
<head><script src='//production-assets.codepen.io/assets/editor/live/console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/events_runner-73716630c22bbc8cff4bd0f07b135f00a0bdc5d14629260c3ec49e5606f98fdd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/css_live_reload_init-2c0dc5167d60a5af3ee189d570b1835129687ea2a61bee3513dee3a50c115a77.js'></script><meta charset='UTF-8'><meta name="robots" content="noindex"><link rel="shortcut icon" type="image/x-icon" href="//production-assets.codepen.io/assets/favicon/favicon-8ea04875e70c4b0bb41da869e81236e54394d63638a1ef12fa558a4a835f1164.ico" /><link rel="mask-icon" type="" href="//production-assets.codepen.io/assets/favicon/logo-pin-f2d2b6d2c61838f7e76325261b7195c27224080bc099486ddd6dccb469b8e8e6.svg" color="#111" /><link rel="canonical" href="https://codepen.io/TrevorEyre/pen/dvNwqG?depth=everything&order=popularity&page=4&q=device&show_forks=false" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css'><link rel='stylesheet prefetch' href='https://trevoreyre.com/styles/codepen/base.min.css'>
<style class="cp-pen-styles">.device {
border-radius: 20px;
position: relative;
box-sizing: border-box;
background: #fff;
box-shadow: inset 0 4px 7px 1px #fff, inset 0 -5px 20px rgba(173, 186, 204, 0.25), 0 2px 6px rgba(0, 21, 64, 0.14), 0 10px 20px rgba(0, 21, 64, 0.05);
}
.device img {
width: 100%;
border-radius: 4px;
border: 1px solid rgba(0, 0, 0, 0.24);
}
.device::before,
.device::after {
content: "";
display: block;
position: absolute;
background: #fff;
box-shadow: inset 0 4px 7px 1px #fff, inset 0 -5px 20px rgba(173, 186, 204, 0.25), 0 2px 6px rgba(0, 21, 64, 0.14), 0 10px 20px rgba(0, 21, 64, 0.05);
}
.phone {
padding: 12% 3%;
}
.phone.landscape {
padding: 1.75% 8%;
}
.tablet {
padding: 8% 2%;
}
.tablet.landscape {
padding: 1.12% 6%;
}
.laptop {
margin-left: 12%;
margin-right: 12%;
margin-bottom: 2.5%;
border-radius: 1vw;
padding: 1.35%;
}
.desktop {
margin-bottom: 11%;
border-radius: 1vw;
padding: 1.5%;
}
.phone::after {
border-radius: 50%;
margin: 0 auto 2%;
left: 0;
right: 0;
bottom: 0;
width: 10%;
height: 0;
padding-top: 10%;
box-shadow: inset 0 0 5px 1px rgba(0, 0, 0, 0.12);
}
.phone.landscape::after {
margin: auto 0;
left: calc(100% - 7%);
top: 0;
bottom: 0;
width: 6%;
padding-top: 6%;
}
.phone::before {
border-radius: 50px;
margin: 5.5% auto 0;
left: 0;
right: 0;
top: 0;
width: 20%;
height: 1%;
box-shadow: inset 0 0 3px 1px rgba(0, 0, 0, 0.12);
}
.phone.landscape::before {
margin: auto 0 auto 4.5%;
left: 0;
top: 0;
bottom: 0;
width: 1%;
height: 20%;
}
.tablet::after {
border-radius: 50%;
margin: 0 auto 2%;
left: 0;
right: 0;
bottom: 0;
width: 6%;
height: 0;
padding-top: 6%;
box-shadow: inset 0 0 5px 1px rgba(0, 0, 0, 0.12);
}
.tablet.landscape::after {
margin: auto 0;
left: calc(100% - 5.25%);
top: 0;
bottom: 0;
width: 4.5%;
padding-top: 4.5%;
}
.tablet::before {
border-radius: 50%;
margin: 3.5% auto 0;
left: 0;
right: 0;
top: 0;
width: 2.25%;
height: 0;
padding-top: 2.25%;
background: #eee;
box-shadow: inset 0 0 3px 1px rgba(0, 0, 0, 0.12);
}
.tablet.landscape::before {
margin: auto 0 auto 2.5%;
left: 0;
top: 0;
bottom: 0;
width: 1.75%;
padding-top: 1.75%;
}
.laptop::after {
border-radius: 4px 4px 48px 48px;
left: -15%;
bottom: -4%;
width: 130%;
height: 7%;
}
.desktop::before {
margin: 0 auto;
left: 0;
right: 0;
bottom: -18%;
width: 20%;
height: 20%;
background: #fafafa;
z-index: -1;
}
.desktop::after {
border-radius: 4px 4px 24px 24px;
margin: 0 auto;
left: 0;
right: 0;
bottom: -19.5%;
width: 34%;
height: 2%;
}
.device-collection {
width: 100%;
position: relative;
}
.device-collection::after {
content: "";
display: block;
padding-top: 62.75%;
}
.device-collection .phone-container,
.device-collection .tablet-container,
.device-collection .desktop {
position: absolute;
bottom: 0;
}
.device-collection .phone,
.device-collection .tablet {
margin: 0;
}
.device-collection .phone-container {
left: 0;
max-width: 15%;
z-index: 2;
}
.device-collection .tablet-container {
right: 0;
max-width: 30%;
z-index: 1;
}
.device-collection .desktop {
left: 0;
right: 0;
margin: 0 5% 10.25%;
}
@media (max-width: 800px) {
.device-collection .device {
border-radius: 1vw;
}
}
body {
margin: 0;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-flow: row wrap;
flex-flow: row wrap;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.container,
.device-collection {
max-width: 100%;
margin: 40px;
}
</style></head><body>
<header>
<h1>Simple device mockups in CSS</h1>
<p>Simple, responsive, single-div device mockups using raw CSS. Inspired by <a href='https://stripe.com/' target='_blank'>Stripe</a>. The devices automatically size to the dimensions of the image inside them.</p>
</header>
<div class='device-collection'>
<div class='phone-container'>
<div class='device phone'>
<img src='https://trevoreyre.com/img/gbo-phone.jpg'>
</div>
</div>
<div class='tablet-container'>
<div class='device tablet'>
<img src='https://trevoreyre.com/img/gbo-tablet.jpg'>
</div>
</div>
<div class='device desktop'>
<img src='https://trevoreyre.com/img/gbo-desktop.jpg'>
</div>
</div>
<div class='container'>
<div class='device phone'>
<img src='https://placehold.it/187x333'>
</div>
</div>
<div class='container'>
<div class='device phone landscape'>
<img src='https://placehold.it/333x187'>
</div>
</div>
<div class='container'>
<div class='device tablet'>
<img src='https://placehold.it/384x512'>
</div>
</div>
<div class='container'>
<div class='device tablet landscape'>
<img src='https://placehold.it/512x384'>
</div>
</div>
<div class='container'>
<div class='device laptop'>
<img src='https://placehold.it/640x360'>
</div>
</div>
<div class='container'>
<div class='device desktop'>
<img src='https://placehold.it/960x540'>
</div>
</div>
</body></html>