<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,body{
height: 100%;
width: 100%;
}
html{
font-size: 10px;
}
.tab{
width: 40rem;
height: 30rem;
background-color: antiquewhite;
}
.biao{
width: 100%;
height: 5rem;
background-color: rgb(0, 0, 0);
display: flex;
justify-content: space-between;
}
.ti{
width: 33%;
height: 100%;
background-color: rgb(255, 166, 0);
text-align: center;
line-height: 5rem;
font-size: 1.8rem;
cursor: pointer;
}
.ti:last-child{
border-right: none;
}
.ti:hover{
background-color: rgb(255, 228, 179);
color: rgb(237, 155, 155);
}
.nei{
width: 100%;
height: calc(100% - 5rem);
background-color: rgb(0, 0, 0);
position: relative;
}
.con{
width: 100%;
height: 100%;
background-color: rgb(40, 158, 255);
font-size: 1.6rem;
}
.con:nth-of-type(1){
background-color: rgb(255, 228, 179);
display: block;
}
.con:nth-of-type(2){
background-color: brown;
}
.con:nth-of-type(3){
background-color: rgb(127, 255, 212);
}
</style>
</head>
<body>
<div class="tab">
<div class="biao">
<div class="ti">标题1</div>
<div class="ti">标题2</div>
<div class="ti">标题3</div>
</div>
<div class="nei">
<div class="con">内容1</div>
<div class="con">内容2</div>
<div class="con">内容3</div>
</div>
<script>
let tts = document.getElementsByClassName('ti');
for(let i = 0; i < tts.length; i++){
tts[i].onmouseenter = function(){
console.log('点击了第'+i+'个');
let tcs = document.getElementsByClassName('con');
for(let j = 0; j < tcs.length; j++){
tcs[j].style.display = 'none';
}
tcs[i].style.display = 'block';
}
}
</script>
</div>
</body>
</html>
选项卡
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
相关阅读更多精彩内容
- 需求场景 说起登录,你可能会不屑一顾,还有比这更简单的功能吗? 获取一下用户提交参数 username + pas...
- 1.登录成功后保存账号密码 NSUserDefaults*userDefaults = [NSUserDefaul...
- 一、需求分析 如果你经常使用腾讯QQ,就会发现它的登录有如下特点:它可以手机电脑同时在线,但是不能在两个手机上同时...
- 一、在微信开放平台创建移动应用 点击创建移动应用 二、拿到微信登录权限 三、app或小程序授权 1. app在拿到...