0
点赞
收藏
分享

微信扫一扫

纯HTML、CSS写一个简单的水滴特效,水滴里面可加图标

霸姨 2022-02-26 阅读 55
csshtmlcss3

CSS写水滴特效,里面可加图标

代码如下(示例):
HTML部分

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="drop.css">
    </head>
<body>
    <div class="drop"><ion-icon></ion-icon></div>
    //里面可以自己加icon
    
</body>
</html>

CSS部分

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-width: 100vw;
    background: #eee;
}

.drop {
    position: relative;
    width: 150px;
    height: 150px;
    box-shadow: inset 10px 10px 10px rgba(0, 0, 0, .05),
        15px 25px 10px rgba(255, 255, 255, .05),
        15px 20px 20px rgba(0, 0, 0, .05),
        inset -10px -10px 15px rgba(255, 255, 255, .9);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.drop::before {
    content: '';
    position: absolute;
    top: 35px;
    left: 25px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
}

.drop::after {
    content: '';
    position: absolute;
    top: 25px;
    left: 50px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
}

在这里插入图片描述

举报

相关推荐

0 条评论