其他分享
首页 > 其他分享> > z-index仅能在定位元素上有效

z-index仅能在定位元素上有效

作者:互联网

mrgin负值运用,解决产品列表盒子边框合并问题,同时鼠标指上后改变边框状态

<!DOCTYPE html>
<html lang="zh-CN">
<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>
    <style>
        li {
            position: relative;
            width: 200px;
            height: 300px;
            border: 1px solid pink;
            list-style: none;
            float: left;
            margin-left: -1px;
        }
        li:hover {
            border: 1px solid blue;
            z-index: 1;
        }
    </style>
</head>
<body>
    <ul>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>
</body>
</html>

 

标签:index,定位,solid,li,仅能,1px,border,left
来源: https://www.cnblogs.com/uujay/p/16367420.html