效果:
代码:
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>iPhone 模型框架</title>
<style>
body {
height: 100%;
height: 100%;
margin: 0;
padding: 30px;
display: flex;
justify-content: center;
align-items: center;
background-color: #ffffff;
}
.iphone {
position: relative;
width: 376px;
/* iPhone 宽度 */
height: 648px;
/* iPhone 高度 */
border: 16px solid #120f0f;
/* 手机边框 */
border-radius: 40px;
/* 边角圆润 */
background: #fff;
/* 手机背景色 */
box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
/* 阴影效果 */
margin: 0;
padding: 0;
background-color: #EEEEEE;
border-top-width: 90px;
border-bottom-width: 110px;
border-left-width: 30px;
border-right-width: 30px;
}
.iphone .iphone-box {
position: absolute;
left: -20px;
top: -80px;
width: 376px;
/* iPhone 宽度 */
height: 648px;
/* iPhone 高度 */
border: 16px solid #000;
/* 手机边框 */
border-radius: 40px;
/* 边角圆润 */
background: transparent;
/* 手机背景色 */
box-shadow: 0 0 10px rgba(222, 222, 222, 0.5);
/* 阴影效果 */
margin: 0;
padding: 0;
border-top-width: 80px;
border-bottom-width: 100px;
border-left-width: 20px;
border-right-width: 20px;
}
/* 听筒 */
.iphone .receiver{
position: absolute;
top: -48px;
left: calc(50% - 42px);
width: 84px;
height: 8px;
background-color: #444;
border-radius: 4px;
}
/* 摄像头 */
.iphone .camera {
position: absolute;
top: -51px;
left: calc(50% - 85px);
width: 14px;
height: 14px;
background-color: #EE0000;
border-radius: 7px;
animation: camera 1.5s infinite alternate;
}
@keyframes camera {
0% {
background-color: #000088;
}
50% {
background-color: #00EE00;
}
100% {
background-color: #000088;
}
}
.iphone .home-button {
position: absolute;
bottom: -84px;
left: calc(50% - 30px);
width: 60px;
height: 60px;
border: 1px solid #444;
border-radius: 50%;
background-color: #001;
box-shadow: 0 0 10px #333;
}
.iphone .home-button:hover{
box-shadow: 0 0 20px #FFFF00;
}
/* 设置按钮定时动画 */
.iphone .home-button:before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%;
animation: button-pulse 2s infinite;
}
@keyframes button-pulse {
0% {
box-shadow: 0 0 5px #FFFFFF;
}
50% {
box-shadow: 0 0 20px #FFFFFF;
}
100% {
box-shadow: 0 0 5px #FFFFFF;
}
}
.iphone .volume-up {
position: absolute;
width: 6px;
height: 60px;
background-color: #000;
left: -34px;
border: 1px solid #000;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
top: 10%;
}
.iphone .volume-down{
position: absolute;
width: 6px;
height: 60px;
background-color: #000;
left: -34px;
border: 1px solid #000;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
top: calc(10% + 80px);
}
.iphone .power{
position: absolute;
width: 6px;
height: 90px;
background-color: #000;
right: -34px;
border: 1px solid #000;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
top: calc(10% + 20px);
}
.screen {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
border: 0px solid #000000;
background: url(/uploads/posts/2026/12/01-55798f62e4bf60e2c0b44135.png) no-repeat center center;
background-size: 64px 64px;
/* background-position: center; */
}
iframe {
margin: 0;
padding: 0;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
border: 0px solid #444;
}
</style>
</head>
<body>
<div class="iphone">
<div class="iphone-box">
<div class="receiver"></div>
<div class="camera"></div>
<div class="volume-up"></div>
<div class="volume-down"></div>
<div class="power"></div>
<a href="https://cpp.vin" class="home-button"></a>
<div class="screen">
<iframe src="https://cpp.vin" frameborder="0"></iframe>
</div>
</div>
</div>
</body>
</html>
评论 0
友善交流,让讨论变得更有价值。