css实现4种咖啡杯子效果

代码语言:html

所属分类:布局界面

代码描述:css实现4种咖啡杯子效果

代码标签: 咖啡 杯子 效果

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
/* ***** Colors - Start ***** */
/* ***** Colors - End ***** */
/* ***** Global Styles - Start ***** */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #bc9b71;
  overflow: hidden;
}

.container, .mug {
  display: flex;
  justify-content: center;
  align-items: center;
}

.soft-drink-cup-1-wrapper .soft-drink-cup, .soft-drink-cup-2-wrapper .soft-drink-cup, .soft-drink-cup-3-wrapper .soft-drink-cup {
  width: 52px;
  height: 80px;
  margin-left: 40px;
  background-color: #fff;
  clip-path: polygon(0 0, 100% 0%, 80% 100%, 20% 100%);
}

/* ***** Global Styles - End ***** */
/* ***** Specific Styles - Start ***** */
.container {
  height: 100vh;
}

.mug {
  width: 52px;
  height: 60px;
  background-color: #fff;
  z-index: 3;
  border-radius: 5px;
}
.mug:before {
  content: "";
  width: 25px;
  height: 25px;
  border: 10px solid #fff;
  border-radius: 50%;
  margin-left: -58px;
  z-index: 2;
}

.soft-drink-cup-1-wrapper .soft-drink-cup:before {
  content: "";
  position: absolute;
  width: 40px;
  height: 45px;
  margin: 30px 0 0 6px;
  background-color: #b58c6a;
  clip-path: polygon(5% 0, 95% 0%, 80% 100%, 20% 100%);
}
.soft-drink-cup-1-wrapper .soft-drink-cup .ice-cubes {
  position: absolute;
  width: 0;
  height: 0;
  border-top: 8px solid #d5b498;
  border-right: 8px solid #fff;
  margin: 26px 0 0 11px;
  background-color: #fff;
  transform: rotate(45deg);
  z-index: 2;
  animation: animateCubes 1s infinite;
}
.soft-drink-cup-1-wrapper .soft-drink-cup .ice-cubes:before {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 24px;
  transform: rotate(30deg);
  background-color: #fff;
  z-index: 3;
}
.soft-drink-cup-1-wrapper .soft-drink-cup .ice-cubes:after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  margin: 2px 0 0 25px;
  transform: rotate(55deg);
  background-color: #d5b498;
}
.soft-drink-cup-1-wrapper .cap {
  position: absolute;
  width: 60px;
  height: 7px;
  margin: -85px 0 0 36px;
  background-color: #fff;
  z-index: 2;
}
.soft-drink-cup-1-wrapper .straw {
  position: absolute;
  width: 5px;
  height: 80px;
  margin: -130px 0 0 63px;
  background-color: #377c43;
}

.soft-drink-cup-2-wrapper .soft-drink-cup:before {
  content: "";
  position: absolute;
  width: 100%;
  height: 45px;
  margin-top: 5px;
  background-color: #a07d4e;
}
.soft-drink-cup-2-wrapper .cap {
  position: absolute;
  width: 60px;
  height: 7px;
  margin: -85px 0 0 36p.........完整代码请登录后点击上方下载按钮下载查看

网友评论0