选项卡开发

代码实现

''''html
<!DOCTYPE html>
<html lang="zh">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>选项卡</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

    heml,
    body {
        height: 100%;
        width: 100%;
    }

    html {
        font-size: 10px;
    }

    .tab {
        width: 40rem;
        height: 30rem;
        border: solid 2px rgb(216, 49, 49);
        border-radius: 8px;
        overflow: hidden;
    }

    .tab-title {
        border-bottom: solid 1px rgb(184, 42, 203);
        height: 5rem;
        width: 100%;
        display: flex;
        justify-content: space-between;
    }

    .tt {
        border-right: solid 1px rgb(236, 55, 55);
        width: 33%;
        height: 5rem;
        text-align: center;
        line-height: 5rem;
        font-size: 1.8rem;
        cursor: pointer;
    }

    .tab-title .tab:last-child {
        border-right: none;
    }

    .tt:hover {
        background-color: rgb(194, 19, 217);
        color: white;
    }

    .tab-content {
        height: 100%;
        width: 100%;
        position: relative;
        overflow: hidden;
        background-color: rgb(237, 31, 31);
    }

    .tab-content.tc {
        width: 100%;
        height: 100%;
        color: white;
        font-size: 1.6rem;
        text-align: center;
        position: absolute;
        display: none;
    }

    .tc:nth-of-type(1) {
        background-color: rgb(228, 19, 19);
        display: block;
    }

    .tc:nth-of-type(2) {
        background-color: rgb(195, 0, 255);
    }

    .tc:nth-of-type(3) {
        background-color: rgb(226, 43, 43);
    }
</style>

</head>

<body>
<div class="tab">
<div class="tab-title">
<div class="tt">标题1</div>
<div class="tt">标题2</div>
<div class="tt">标题3</div>
</div>
<div class="tab-content">
<div class="tc">内容1</div>
<div class="tc">内容2</div>
<div class="tc">内容3</div>
</div>
</div>
</body>

</html>

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 主要是实现网页中的选项卡效果,当鼠标在标题上移动时选项卡上对应的标题也随之变化 主要代码如下: <!DOCTYPE...
    L_2936阅读 44评论 0 0
  • 效果 代码展示:<!DOCTYPE html> 选项卡 * {margin: 0;padding: 0;box-...
    风流_8cce阅读 669评论 0 0
  • 练习了一个选项卡样式 框选选项卡的大边框 给其加css样式2.排列内部内容,分为两个部分,标题和内容,先弄标题+c...
    画梅阅读 37评论 0 0
  • 好久没有更新了,今天更新点东西。 大多数的商城类小程序都有这个功能,点击“全部订单”,“待付款”,“待发货”,“待...
    _vb阅读 4,587评论 0 2
  • <!DOCTYPE html> 选项卡 *{margin: 0; padding: 0; box-siz...
    b8a282f5d556阅读 48评论 0 0