CSS——小米首页悬浮栏效果

简介: 小米首页悬浮栏效果

05d53bea716146b3a4c25626e470de3c.gif

这种悬浮效果该如何制作?

<!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>悬浮效果</title>
    <style>
        li{
    width: 234px;
    height: 300px;
    border: black 1px solid;
    background-color: rgb(250,250,250);
    float: left;
    list-style: none;
    margin: 13px 12px 0 0px;
    position: relative;
    top: 0;
    transition: all 0.5s;
}
li:hover{
    top: -5px;
    box-shadow: 5px 5px 25px gray;
}
    </style>
</head>
<body>
    <ul>
        <li></li>
        <li></li>
        <li></li>
    </ul>
</body>
</html>

效果如下:

fbd9570b5480415e901f4674d0e791aa.gif

当然如果要是觉得阴影过重或者阴影颜色不一致的情况可以参考下面的代码

<!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>悬浮</title>
    <style>
        li{
    width: 234px;
    height: 300px;
    /* border: black 1px solid; */
    background-color: rgb(250,250,250);
    float: left;
    list-style: none;
    text-align: center;
    margin: 13px 12px 0 0px;
    position: relative;
    top: 0;
    transition: all 0.5s;
}
li:hover{
    top: -5px;
    box-shadow: 2px 2px 15px rgb(225,225,225);
}
    </style>
</head>
<body>
    <ul>
        <li></li>
        <li></li>
        <li></li>
    </ul>
</body>
</html>

3f0e9b2eca8e428399729745b1c571bc.gif

相关文章
|
8月前
|
前端开发
HTML+CSS实现小米官网首页(一)
HTML+CSS实现小米官网首页
|
8月前
|
前端开发
HTML和CSS实现京东首页(html和css详解)(一)
HTML和CSS实现京东首页(html和css详解)
|
3月前
|
前端开发
当当网首页——CSS代码
当当网首页——CSS代码
|
9月前
|
前端开发 Python
京东首页静态页面html+css
京东首页静态页面html+css
51 0
|
8月前
|
前端开发
|
8月前
|
前端开发
HTML+CSS实现小米账号注册界面
HTML+CSS实现小米账号注册界面
|
8月前
|
前端开发
HTML+CSS实现小米登录界面
HTML+CSS实现小米登录界面