预览:

代码(vue):
<template>
<div class="device iphone">
<div class="frame">
<div class="content">
<el-image style="width: 100%; height: 100%;" :src="contentImg" fit="fill"></el-image>
</div>
</div>
<div class="stripe"></div>
<div class="header">
<div class="sensors"></div>
</div>
<div class="btns"></div>
<div class="power"></div>
</div>
</template>
<script>
export default {
props: {
contentImg: {
default: ''
},
}
}
</script>
<style lang="scss" scoped>
.device *,
.device *::before,
.device *::after {
box-sizing: border-box;
display: block;
}
.device .frame {
z-index: 1;
}
.iphone {
height: 324px;
width: 170px;
transform: scale(0.9);
display: inline-block;
}
.iphone .frame {
background: #222;
border-radius: 27px;
box-shadow: inset 0 0 0 2px #606467, inset 0 0 0 4px #e2e3e4;
height: 324px;
padding: 10px;
width: 170px;
}
.iphone .content {
background-color: #fff;
border-radius: 16px;
height: 304px;
position: relative;
width: 150px;
overflow: hidden;
}
.iphone .stripe::after,
.iphone .stripe::before {
border: solid rgba(51, 51, 51, .25);
border-width: 0 6px;
content: "";
height: 5px;
left: 0;
position: absolute;
width: 100%;
z-index: 9;
}
.iphone .stripe::after {
top: 68px;
}
.iphone .stripe::before {
bottom: 68px;
}
.iphone .header {
background: #222;
height: 17px;
left: 56%;
margin-left: -41px;
position: absolute;
top: 12px;
width: 66px;
z-index: 199;
border-radius: 15px;
}
.iphone .header::after {
background: radial-gradient(circle at bottom left, transparent 0, transparent 75%, #222 75%, #222 100%);
left: -3px;
}
.iphone .header::before {
background: radial-gradient(circle at bottom right, transparent 0, transparent 75%, #222 75%, #222 100%);
right: -3px;
}
.iphone .sensors::after,
.iphone .sensors::before {
content: "";
position: absolute;
}
.iphone .sensors::before {
background: #444;
border-radius: 50%;
height: 5px;
left: 50%;
margin-left: 20px;
top: 7px;
width: 5px;
background: radial-gradient(circle at 70% 30%, #6b7bc3, #4c2290 10%, #5256a1, transparent);
box-shadow: 0 0 2px #131420,
0 0 2px #131420 inset,
2px 0 4px #5256a1 inset;
}
.iphone .btns {
background: #606467;
height: 13px;
left: -1px;
position: absolute;
top: 46px;
width: 1px;
}
.iphone .btns::after,
.iphone .btns::before {
background: #606467;
content: "";
height: 25px;
left: 0;
position: absolute;
width: 2px;
}
.iphone .btns::after {
top: 24px;
}
.iphone .btns::before {
top: 56px;
}
.iphone .power {
background: #606467;
height: 40px;
position: absolute;
right: -1px;
top: 80px;
width: 1px;
}
</style>