css练手 tabs选项卡切换

2022/2/15 23:13:56

本文主要是介绍css练手 tabs选项卡切换,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title></title>
    <style>
        .box {
             width: 60%;
            height: 500px;
            border: 1px solid yellowgreen;
        }

        .tabs {
            display: flex;
            height: 10%;
         }

        span {
            box-sizing: border-box;
            width: 100px;
            height: 100%;
            line-height: 50px;
            text-align: center;
            border: 1px solid yellowgreen;
            border-width: 0px 1px 1px 0px;
            background-color: #fff;
            user-select: none;
        }   

        span:hover {
            border-bottom: none;    
        }

        .panel {
            margin-top: -1px;
            width: 100%;
            height: calc(100% - 10%) ;
            border-top: 1px solid yellowgreen;
            z-index: -1;
        }
    </style>
  </head>
  <body>
    <div class="box">
        <div class="tabs">
            <span>这是tab1</span>
            <span>这是tab2</span>
            <span>这是tab3</span>
        </div>
        <div class="panel"></div>
    </div>
  </body>
</html>

 



这篇关于css练手 tabs选项卡切换的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程