CSS Trick10
Mobile-like design
by Soya Natsuki
HTML
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<div class="mobile">
<div class="top"></div>
<div class="bottom"></div>
<div class="screen">
<img src="https://i.ibb.co/vPv6tT2/bg.jpg">
<h2>10:40<span>AM</span><br><span>26th Jan, 2019</span></h2>
<ul>
<li><i class="fa fa-phone" aria-hidden="true"></i></li>
<li><i class="fa fa-comment-o" aria-hidden="true"></i></li>
<li><i class="fa fa-picture-o" aria-hidden="true"></i></li>
<li><i class="fa fa-camera" aria-hidden="true"></i></li>
</ul>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.bottom').click(function() {
$('.screen').toggleClass('active')
})
})
</script>
CSS
@import url('https://fonts.googleapis.com/css?family=Poppins:100,200,300,400,500,600,700,800,900');
body
{
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
font-family: 'Poppins', sans-serif;
background: url(https://i.ibb.co/zhTRD21/background.jpg);
background-size: cover;
}
.mobile
{
position: relative;
width: 270px;
height: 480px;
background: #020c17;
}
.top
{
position: absolute;
top: -50px;
width: 100%;
height: 50px;
background: #efefef;
border-top-left-radius: 40px;
border-top-right-radius: 40px;
}
.top:before
{
content: '';
position: absolute;
top: 50%;
left: 35%;
transform: translateY(-50%);
width: 4px;
height: 4px;
background: #ccc;
border: 2px solid #aaa;
border-radius: 50%;
box-shadow: 0 0 0 1px #999;
}
.top:after
{
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
width: 40px;
height: 3px;
background: #333;
border: 2px solid #aaa;
border-radius: 3px;
}
.bottom
{
position: absolute;
bottom: -50px;
width: 100%;
height: 50px;
background: #efefef;
border-bottom-left-radius: 40px;
border-bottom-right-radius: 40px;
}
.bottom:before
{
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
width: 15px;
height: 15px;
border: 2px solid #999;
cursor: pointer;
border-radius: 6px;
}
.screen
{
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
display: flex;
justify-content: center;
}
.screen img
{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
opacity: 0;
transition: 0.5s;
}
.screen.active img
{
opacity: 1;
}
.screen:before
{
content: '';
position: absolute;
top: 0;
left: -50%;
width: 100%;
height: 100%;
background: rgba(255,255,255,.1);
z-index: 1;
transform: skewX(-5deg);
}
h2
{
color: #fff;
font-weight: 200;
font-size: 3.5em;
z-index: 1;
transform: translateY(50px);
line-height: 0.4em;
transition:...