css绘制一个响应式自适应建筑小洋房楼房效果代码

代码语言:html

所属分类:响应式

代码描述:css绘制一个响应式自适应建筑小洋房楼房效果代码

代码标签: css 响应式 建筑 楼房 洋楼

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


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

<head>

  <meta charset="UTF-8">


  
  
<style>
* {
  box-sizing: border-box;
}

body {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-direction: column;
  height: 100vh;
  background: #a2d8f3;
}

.body {
  position: relative;
}

.roof .top {
  width: calc(100% + 2 * calc(2 * 1vmin));
  background: linear-gradient(#DD9980, #DD9980 50%, #AF5842 50%);
  height: calc(2 * 1vmin);
  position: relative;
  left: calc(-2 * 1vmin);
}
.roof .top:before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 1vmin 0 0 1vmin;
  border-color: transparent transparent transparent #a2d8f3;
}
.roof .top:after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 1vmin 1vmin;
  border-color: transparent transparent #a2d8f3 transparent;
}
.roof .middle {
  width: calc(100% + calc(2 * 1vmin));
  background-image: linear-gradient(90deg, #D8785B 25%, #AF5842 25%, #AF5842 50%, #D8785B 50%, #D8785B 75%, #AF5842 75%, #AF5842 100%);
  background-size: calc(6 * 1vmin) calc(6 * 1vmin);
  height: calc(2 * 1vmin);
  position: relative;
  left: calc(-1 * 1vmin);
}
.roof .bottom {
  width: 100%;
  background: #AF5842;
  height: calc(4 * 1vmin);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 1vmin;
}
.roof .bottom span {
  border: calc(0.75 * 1vmin) solid #86432F;
  border-bottom: none;
  width: calc( 80% / 4);
  height: 100%;
  position: relative;
}
.roof .bottom span:before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  background: #86432F;
  height: calc(2 * 1vmin);
  width: calc(4 * 1vmin);
  border-top-right-radius: calc(2 * 1vmin);
  border-top-left-radius: calc(2 * 1vmin);
}

.chimney1 {
  width: calc(3 * 1vmin);
  height: calc(4 * 1vmin);
  background: #D8785B;
  position: absolute;
  left: calc(6 * 1vmin);
  top: calc(-4 * 1vmin);
}
.chimney1:before {
  position: absolute;
  top: 0;
  content: "";
  width: calc(100% + 1vmin);
  left: calc(-0.5 * 1vmin);
  height: 1vmin;
  background: #DD9980;
}

.chimney2 {
  width: calc(6 * 1vmin);
  height: calc(4 * 1vmin);
  background: #D8785B;
  position: absolute;
  left: calc(12 * 1vmin);
  top: calc(-4 * 1vmin);
}
.chimney2:before {
  position: absolute;
  top: 0;
  content: "";
  width: calc(100% + 1vmin);
  left: calc(-0.5 * 1vmin);
  height: 1vmin;
  background: #DD9980;
}

.antenna {
  position: absolute;
  right: calc(8 * 1vmin);
  top: calc(-7 * 1vmin);
  width: 1vmin;
  height: calc(7 * 1vmin);
  background: #889BAD;
}
.antenna:before {
  content: "";
  position: absolute;
  height: 1vmin;
  width: calc(10 * 1vmin);
  left: calc(-4.5 * 1vmin);
  top: 1vmin;
  background: #889BAD;
}
.antenna span {
  position: absolute;
  width: 1vmin;
  background: #889BAD;
}
.antenna .ant1 {
  height: calc(4 * 1vmin);
  left: calc(-4.5 * 1vmin);
  top: calc(-0.5 * 1vmin);
}
.antenna .ant2 {
  height: calc(3 * 1vmin);
  left: calc(-2 * 1vmin);
}
.antenna .ant3 {
  height: calc(3 * 1vmin);
  right: calc(-2 * 1vmin);
}
.antenna .ant4 {
  height: calc(4 * 1vmin);
  right: calc(-4.5 * 1vmin);
  top: calc(-0.5 * 1vmin);
}

.floor {
  width: calc(2 * calc(20 * 1vmin));
  height: calc(20 * 1vmin);
  background: #D8785B;
  border-top: #AF5842 solid calc(2 * 1vmin);
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
}
.floor:before {
  content: "";
  position: absolute;
  top: calc(-2 * 1vmin);
  left: -1vmin;
  height: 1vmin;
  width: calc(100% + 2 * 1vmin);
  background: #DD9980;
}

.window {
  position: relative;
  top: calc(4 *1vmin);
  width: calc(1vmin * 6);
  height: calc(1vmin * 10);
}
.window:before {
  content: "";
  position: absolute;
  top: 50%;
  width: 100%;
  height: 1vmin;
  background: #573026;
}

.windowFrame {
  height: 100%;
  width: 100%;
  background: #62A1CB;
  border: 1vmin solid #573026;
}

.windowTop {
  height: 1vmin;
  width: calc(100% + 2 * 1vmin);
  position: absolute;
  left: -1vmin;
  background: #DD9980;
  z-index: 1;
  top: -1vmin;
}
.windowTop:before {
  content: "";
  position: absolute;
  top: calc(-2 * 1vmin);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 calc(4 * 1vmin) calc(2 * 1vmin) calc(4 * 1vmin);
  border-color: transparent transparent #DD9980 transparent;
}
.windowTop:after {
  content: "";
  position: absolute;
  top: calc(-1 * 1vmin);
  left: 0;
  right: 0;
  width: 0;
  height: 0;
  margin: 0 auto;
  border-style: solid;
  border-width: 0 1vmin 1vmin 1vmin;
  border-color: transparent transparent #AF5842 transparent;
  opacity: 0.7;
}

.windowBottom {
  height: calc(2* 1vmin);
  width: calc(100% + 2 * 1vmin);
  position: absolute;
  left: -1vmin;
  background: linear-gradient(#DD9980 0, #DD9980 50%, #86432F 50%);
}

.window9 {
  visibility: hidden;
  opacity: 0;
}

.window1 .windowFrame {
  background: linear-gradient(90deg, #FEC864 1vmin, #FEC864 1vmin, #AA803E 1vmin, #AA803E calc(2 * 1vmin), #FEC864 calc(2 * 1vmin));
}

.window2 .windowFrame,
.window4 .windowFrame,
.window7 .windowFrame {
  background: linear-gradient(-225deg, #62A1CB, #62A1CB 1vmin, #82C7D0 1vmin, #82C7D0 2vmin, #62A1CB 2vmin, #62A1CB 3vmin, #82C7D0 3vmin, #82C7D0 4vmin, #62A1CB 4vmin);
}

.window3 .windowFrame {
  background: linear-gradient(#62A1CB, #62A1CB 50%, #AA803E 50%);
}

.window5 .windowFrame {
  background: linear-gradient(90deg, #FEC864, #FEC864 calc(2 * 1vmin), #AA803E calc(2 * 1vmin));
}

.window6 .windowFrame {
  background: #FEC864;
}

.window8 .windowFrame {
  background: linear-gradient(-225deg, #62A1CB, #62A1CB 1vmin, #82C7D0 1vmin, #82C7D0 calc(2.5 * 1vmin), #62A1CB calc(2.5 * 1vmin));
}

.zeroLevel {
  width: 100%;
  height: calc(8 * 1vmin);
  position: relative;
  background: linear-gradient(#7F6A4D, #7F6A4D 1vmin, #523127 1vmin, #523127 calc(2 * 1vmin), #7F6A4D calc(2 * 1vmin));
}

.stairs {
  height: calc(5 * 1vmin);
  width: 33%;
  background: #71372E;
  position: absolute;
  bottom: 0;
  right: 0;
  background-image: linear-gradient(0deg, #523127 30%, #7F6A4D 30%, #7F6A4D 50%, #523127 50%, #523127 80%, #7F6A4D 80%, #7F6A4D 100%);
  background-size: calc(4 * 1vmin) calc(4 * 1vmin);
}
.stairs .wall {
  position: absolute;
  top: calc(-1 * 1vmin);
  width: calc(3 * 1vmin);
  height: calc(5 * 1vmin);
  background: #86432F;
  border: 1vmin solid #D8785B;
}
.stairs .wall:before {
  content: "";
  position: absolute;
  bottom: calc(-2 * 1vmin);
  left: calc(-1.5 * 1vmin);
  height: calc(2 * 1vmin);
  width: calc(4 * 1vmin);
  background: #DD9980;
}
.stairs .wall:after {
  content: "";
  position: absolute;
  top: calc(-2 * 1vmin);
  left: calc(-1.5 * 1vmin);
  height: calc(2 * 1vmin);
  width: calc(4 * 1vmin);
  background: #DD9980;
}
.stairs .wall1 {
  left: calc(-0.5 * 1vmin);
}
.stairs .wall2 {
  right: calc(-0.5 * 1vmin);
}

.doorWrapper {
  height: calc(calc(20 * 1vmin) - calc(2 * 1vmin));
  width: 33%;
  background: #71372E;
  position: absolute;
  bottom: calc(8 * 1vmin);
  right: 0;
  border: calc(2.5 * 1vmin) solid #7F6A4D;
  border-top-width: calc(3 * 1vmin);
  border-bottom: 0;
  display: flex;
}
.doorWrapper:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1vmin;
  background: #46221c;
}
.doorWrapper .topLight {
  position: absolute;
  width: 70%;
  margin: 0 auto;
  top: calc(1.5 * 1vmin);
  left: 0;
  right: 0;
  background: linear-gradient(90deg, #FEC864, #FEC864, 21%, transparent 21%, transparent 33.3%, #AA803E 33.3%, #AA803E 67%, transparent 67%, transparent 73%, #FEC864 81%, #FEC864 100%);
  height: 1vmin;
}
.doorWrapper .cornice {
  position: absolute;
  width: calc(4 * 1vmin);
  height: 1vmin;
  background: #9f8560;
}
.doorWrapper .cornice:before {
  content: "";
  position: absolute;
  top: calc(1 * 1vmin);
  border-top: 1vmin solid #5f503a;
  border-left: 1vmin solid transparent;
  border-right: 1vmin solid transparent;
  height: 0;
  width: calc(2 * 1vmin);
}
.doorWrapper .cornice1 {
  left: calc(-3 * 1vmin);
}
.doorWrapper .cornice2 {
  right: calc(-3 * 1vmin);
}
.doorWrapper .handrail {
  position: absolute;
  width: 100%;
  bottom: 0;
}
.doorWrapper .handrail .right {
  height: calc(6 * 1vmin);
  width: 1vmin;
  background: #523127;
  display: block;
  position: absolute;
  right: calc(-1.75 * 1vmin);
  bottom: 0;
}
.doorWrapper .handrail .right:before {
  content: "";
  width: calc(1.5 * 1vmin);
  height: calc(1.5 * 1vmin);
  border-radius: 100%;
  background: #523127;
  position: absolute;
  right: calc(-0.25 * 1vmin);
}
.doorWrapper .handrail .left {
  height: calc(6 * 1vmin);
  width: 1vmin;
  background: #523127;
  display: block;
  position: absolute;
  left: calc(-1.75 * 1vmin);
  bottom: 0;
}
.doorWrapper .handrail .left:before {
  content: "";
  width: calc(1.5 * 1vmin);
  height: calc(1.5 * 1vmin);
  border-radius: 100%;
  background: #523127;
  position: absolute;
  top: 0;
  left: calc(-0.25 * 1vmin);
}
.doorWrapper .door {
  width: 70%;
  margin: auto auto 0 auto;
  height: 80%;
  background: #71372E;
  border: calc(2 * 1vmin) solid #523127;
  border-bottom-width: calc(2 * 1vmin);
  border-top-width: calc(2 * 1vmin);
  position: relative;
}
.doorWrapper .door:before {
  content: "";
  position: absolute;
  top: 40%;
  left: 0;
  right: 0;
  margin: 0 auto;
  background: #523127;
  width: 1vmin;
  height: 1vmin;
  border-radius: 50%;
}

.balcony {
  position: absolute;
  bottom: calc(-1 * 1vmin);
  left: calc(-9 * 1vmin);
  width: calc(9 * 1vmin);
  height: 1vmin;
  backgr.........完整代码请登录后点击上方下载按钮下载查看

网友评论0