css布局实现早上一杯咖啡效果代码

代码语言:html

所属分类:布局界面

代码描述:css布局实现早上一杯咖啡效果代码

代码标签: css 咖啡

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

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">




    <style>

        @import url("https://fonts.googleapis.com/css2?family=Bevan&family=Monoton&display=swap");
        * {
          margin: 0;
          padding: 0;
          box-sizing: border-box;
        }
        
        body {
          position: relative;
          width: 100vw;
          max-width: 60rem;
          height: 100vh;
          margin: auto;
          padding: 3rem;
          overflow: hidden;
          background: linear-gradient(to bottom right, #eef0da, #bededd);
          display: flex;
          flex-flow: column nowrap;
          align-items: center;
          align-content: center;
          justify-content: center;
        }
        
        .shadow {
          position: absolute;
          width: 80rem;
          height: 29.9rem;
          top: 32rem;
          left: 3.45rem;
          background: #98b0b0;
          z-index: -2;
          transform-origin: 50% 50%;
          transform: rotate(45deg);
        }
        .shadow:before {
          content: "";
          position: absolute;
          width: 8rem;
          height: 3rem;
          top: -6rem;
          right: 66.3rem;
          background: transparent;
          border-radius: 0 3rem 0 0;
          border: 2.25rem solid #98b0b0;
          z-index: -2;
        }
        
        .coffee {
          position: relative;
          width: 100%;
          height: 100%;
          z-index: -1;
        }
        .coffee__saucer {
          position: absolute;
          width: 35rem;
          height: 35rem;
          top: 0rem;
          left: 0rem;
          border-radius: 50%;
          background: #f4d2a2;
          z-index: -1;
          overflow: hidden;
          box-shadow: inset #fae6ce 0.5rem 0.5rem;
        }
        .coffee__saucer__shadow {
          position: absolute;
          width: 25rem;
          height: 25rem;
          top: 13rem;
          left: 13rem;
          background: #c1a784;
          z-index: -2;
          transform-origin: 50% 50%;
          transform: rotate(45deg);
        }
        .coffee__saucer__shadow:before {
          content: "";
          position: absolute;
          width: 8rem;
          height: 3rem;
          top: -6rem;
          right: 11rem;
          background: #f4d2a2;
          border-radius: 0 3rem 3rem 3rem;
          border: 2.25rem solid #c1a784;
          z-index: -2;
        }
        .coffee__mug {
          position: absolute;
          top: 5rem;
          left: 5rem;
          width: 25rem;
          height: 25rem;
          border-radius: 50%;
          background: #f2e1cd;
          box-shadow: inset #fdfdfb 0.5rem 0.5rem;
        }
        .coffee__mug__drink {
          position: absolute;
          top: 2.5rem;
          left: 2.5rem;
          width: 20rem;
          height: 20rem;
          border-radius: 50%;
          background: #664939;
          box-shadow: inset rgba(102, 73, 57, 0.5) 0.5rem 0.5rem, inset #dda982 2.5rem 2.5rem, inset #fdfdfb -0.5rem -0.5rem, inset #dda982 0.5rem -0.5rem, inset #dda982 -0.75rem -0.75rem, inset #dda982 -0.5rem 0.5rem;
        }
        .coffee__mug__drink:after {
          content: "";
          position: absolute;
          width: 20rem;
          height: 20rem;
          border-radius: 50%;
          background: radial-gradient(circle at 4rem 5rem, #664939, #664939 0.5rem, transparent 0.6rem, transparent), radial-gradient(circle at 6rem 3rem, #664939, #664939 0.25rem, transparent 0.3rem, transparent), radial-gradient(circle at 7rem 3.5rem, #664939, #664939 0.25rem, transparent 0.3rem, transparent), radial-gradient(circle at 12rem 1.5rem, #664939, #664939 0.3rem, transparent 0.4rem, transparent), radial-gradient(circle at 9rem 2rem, #664939, #664939 0.15rem, transparent 0.2rem, transparent), radial-gradient(circle at 7.5rem 1rem, #664939, #664939 0.15rem, transparent 0.2rem, transparent), radial-gradient(circle at 6rem 4rem, #664939, #66.........完整代码请登录后点击上方下载按钮下载查看

网友评论0