界面连接处无缝连接==值得一看

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            border: 0;
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }

        ul {
            list-style: none;
        }

        #ad {
            width: 502px;
            height: 400px;
            border: 1px solid gray;
            margin: 0 auto;
            background-color: rgba(157, 157, 157, 0.65);
            position: relative;
            top: 10px;
        }

        li {
            display: block;
            width: 100px;
            text-align: center;
            padding: 20px 0px;
            float: left;
            border: 1px solid gray;
            border-left: 0px;
            border-top: 0px;
            background-color: rgba(167, 130, 60, 0.4);
        }

        li#l1 {
            border-right: 0px;
        }

        /* 这一点是关键点*/
        li.col {
            border-bottom: 1px solid transparent;
        }
    </style>

</head>
<body>
<div id="ad">
    <ul>
        <li>国际新闻</li>
        <li>国内新闻</li>
        <li>计算机新闻</li>
        <li>国内新闻</li>
        <li id="l1">计算机新闻</li>
    </ul>
</div>
<script>
   var aa=document.getElementsByTagName("li");
   for(var o of aa){
       o.onmouseover=function () {
           //这一点是关键点
           for(var o1 of aa){
               o1.className="";
           }
           this.className="col";
       }
   }


</script>

</body>
</html>

结果:

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值