div+css实现逼真手机效果代码

代码语言:html

所属分类:布局界面

代码描述:div+css实现逼真手机效果代码

代码标签: div css 逼真 手机

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  

  
  
<style>
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap");
html {
  font-size: 100%;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  -ms-overflow-style: scrollbar;
  height: 100%;
  scroll-behavior: smooth;
}

*,
*::before,
*::after {
  -webkit-box-sizing: inherit;
  box-sizing: inherit;
}

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding-top: 40px;
  padding-bottom: 40px;
}

.row {
  display: flex;
}

.col {
  width: 100%;
  flex: 1;
}

.phone {
  background: #000;
  border-radius: 28px;
  padding: 12px;
  width: 320px;
  min-height: 568px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  position: relative;
  margin: 0 auto;
  zoom: 1.1;
  color: #000;
  font-family: "Roboto", sans-serif;
}
.phone .screen .screen-top {
  position: relative;
  z-index: 99;
}
.phone .screen .screen-menu {
  left: 1rem;
  min-height: 40px;
  position: absolute;
  width: calc(100% - 2rem);
  bottom: 1rem;
  display: flex;
}
.phone .screen .screen-menu .icon-wrap {
  flex: 1;
}
.phone .screen .screen-menu .icon-wrap .icon {
  width: 40px;
  height: 40px;
  background: #fff;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0 auto;
  position: relative;
  cursor: pointer;
}
.phone.ios .screen {
  background: #fff;
  min-height: 590px;
  border-radius: 18px;
  background: url(//repo.bfw.wiki/bfwrepo/images/phone/phone-bg.png);
  background-repeat: no-repeat;
  background-size: cover;
  position: relative;
  overflow: hidden;
}
.phone.ios .screen .screen-top {
  padding: 5px 20px;
  position: relative;
}
.phone.ios .screen .screen-top .time {
  font-size: 12px;
  font-weight: 700;
  width: 50px;
  text-align: center;
  color: #fff;
}
.phone.ios .screen .screen-top .phone-status {
  width: 50px;
  position: absolute;
  right: 20px;
  top: 5px;
  background: url(//repo.bfw.wiki/bfwrepo/images/phone/phone-status.svg);
  background-repeat: no-repeat;
  background-size: 100%;
  height: 15px;
}
.phone.ios .phone-top {
  background: #000;
  position: absolute;
  width: 130px;
  top: 0.15rem;
  height: 30px;
  border-bottom-left-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
  left: 50%;
  margin-left: -64px;
  z-index: 2;
}
.phone.ios .phone-top .camera {
  content: "";
  position: absolute;
  left: 105px;
  background: #131313;
  box-shadow: none;
  z-index: 999;
  top: 13px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.phone.ios .phone-top .camera:before {
  content: "";
  position: absolute;
  left: 2px;
  background: #303861;
  box-shadow: none;
  z-index: 999;
  top: 2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.phone.ios .phone-top .camera:after {
  content: "";
  position: absolute;
  left: 2px;
  background: #68a1b3;
  box-shadow: none;
  z-index: 999;
  top: 2px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  opacity: 0.5;
}
.phone.ios .phone-top:after {
  content: "";
  position: absolute;
  left: 50%;
  background: #131313;
  box-shadow: none;
  z-index: 999;
  top: 15px;
  width: 40px;
  height: 4px;
  margin-left: -20px;
  border-radius: 10px;
}
.phone.ios .screen-menu {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(24px);
  padding: 0.75rem;
  border-radius: 1rem;
}
.phone.ios .screen-menu .icon-wrap:nth-of-type(1) .icon {
  background-image: url(//repo.bfw.wiki/bfwrepo/images/phone/icon-phone.svg), linear-gradient(170deg, #58f473 0%, #0bc328 100%);
  background-repeat: no-repeat, repeat;
  background-position: center center;
  background-size: 50%, 100%;
}
.phone.ios .screen-menu .icon-wrap:nth-of-type(2) .icon {
  background-image: url(//repo.bfw.wiki/bfwrepo/images/phone/icon-safari.svg);
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 70%;
}
.phone.ios .screen-menu .icon-wrap:nth-of-type(3) .icon {
  background-image: url(//repo.bfw.wiki/bfwrepo/images/phone/icon-speech.svg), linear-gradient(170deg, #58f473 0%, #0bc328 100%);
  background-repeat: no-repeat, repeat;
  background-position: center center;
  background-size: 60%, 100%;
}
.phone.ios .screen-menu .icon-wrap:nth-of-type(4) .icon {
  background-image: url(//repo.bfw.wiki/bfwrepo/images/phone/icon-music.svg), linear-gradient(170deg, #fb556d 0%, #ff263d 100%);
  background-repeat: no-repeat, repeat;
  background-position: center center;
  background-size: 50%, 100%;
}
.phone.ios:before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 0px;
  left: 0px;
  right: 0px;
  bottom: 0px;
  border: 3px solid #16252f;
  border-radius: 2rem;
  z-index: 0;
}
.phone.ios:after {
  content: "";
  position: absolute;
  left: -3px;
  top: 80px;
  width: 3.5px;
  height: 200px;
  background: url(//repo.bfw.wiki/bfwrepo/images/phone/ios-btns-left.png);
  background-repeat: no-repeat;
  background-size: 100%;
}
.phone.android .phone-top {
  background: transparent;
  position: absolute;
  width: calc(100% - 40px);
  top: 20px;
  height: 30px;
  left: 20px;
  border-top-left-radius: 30px;
  border-top-right-radius: 30px;
  z-index: 1;
}
.phone.android .phone-top .camera {
  content: "";
  position: absolute;
  left: 50%;
  background: #131313;
  box-shadow: none;
  z-index: 999;
  top: 0px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
}
.phone.android .phone-top .camera:before {
  content: "";
  position: absolute;
  left: 2px;
  b.........完整代码请登录后点击上方下载按钮下载查看

网友评论0