html+css 驾考首页设计

效果

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

<head>
  <meta charset="UTF-8">
  <title>17sucai - A Pen by Mark Boots</title>
  <!-- <link rel="stylesheet" href="./style.css"> -->

</head>

<style>
  .cards {

    --gap: 1rem;
    --border-radius: 1rem;
    width: 30rem;
    aspect-ratio: 1/1;
    display: grid;
    grid-template-rows: 1fr 1fr;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
    filter: drop-shadow(5px 5px 5px hsl(0 0% 0% / .5));
    position: relative;


    >.card {

      position: relative;

      &:nth-of-type(1) {
        --x: 0;
        --y: 0
      }

      &:nth-of-type(2) {
        --x: 1;
        --y: 0
      }

      &:nth-of-type(3) {
        --x: 0;
        --y: 1
      }

      &:nth-of-type(4) {
        --x: 1;
        --y: 1
      }

      &::before {
        color: black !important;
        content: "";
        position: absolute;
        inset: 0;
        border-radius: var(--border-radius);
        /* background-image: var(--bg-image); */
        background-color: red;
        --bg-size: calc(200% + var(--gap));
        background-size: var(--bg-size) var(--bg-size);
        background-position: calc(100% * var(--x)) calc(100% * var(--y));
        --mask-pos:
          /* think i can shorten this? */
          calc(100% - (100% * var(--x)) + (var(--gap) / 2) * ((var(--x) * -2) + 1)) calc(100% - (100% * var(--y)) + (var(--gap) / 2) * ((var(--y) * -2) + 1));
        --mask-image: radial-gradient(100% 100% at var(--mask-pos), transparent calc(50% - 1px), black 50%);
        -webkit-mask-image: var(--mask-image);
        mask-image: var(--mask-image);
      }
    }

    >.center {
      position: absolute;
      width: calc(50% - var(--gap) * 2.5);
      aspect-ratio: 1/1;
      /* background-image: var(--bg-image); */
      background-color: yellow;
      --bg-size: calc((100% + var(--gap) * 2.5) * 2);
      background-size: var(--bg-size) var(--bg-size);
      background-position: center;
      inset: 0;
      border-radius: 50%;
      margin: auto;

    }
  }

  html,
  body {
    height: 100%
  }

  body {
    margin: 0;
    display: grid;
    place-items: center
  }
</style>

<body>
  <!-- partial:index.partial.html -->
  <div class="cards">
    <div class="card"></div>
    <div class="card"></div>
    <div class="card">1</div>
    <div class="card"></div>
    <div class="center"></div>
  </div>
  <!-- partial -->

</body>

</html>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值