<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>小網(wǎng)頁(yè)</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body,
html{
height: 100%;
width: 100%;
}
html{
font-size: 10px;
}
.tab{
height: 30rem;
width: 40rem;
background-color: antiquewhite;
display: flex;
justify-content: center;
flex-direction: column;
border: solid 2px orange;
border-radius: 8px;
overflow: hidden;
}
.title{
width: 100%;
height: 5rem;
background-color: aqua;
border-bottom: solid 1px orange;
display: flex;
flex-direction: row;
}
.title .tt{
flex: 1;
height: 5rem;
line-height: 5rem;
text-align: center;
font-size: 1.6rem;
cursor: pointer;
border-right: solid 1px orange;
}
.tt:hover{
background-color: orange;
color: white;
}
.tt:nth-of-type(1){
background-color: orange;
color: white;
}
.tab-content{
width: 100%;
height: 100%;
background-color: aquamarine;
position: relative;
/* overflow: hidden; */
}
.tc{
text-align: center;
font-size: 1.4rem;
position: absolute;
display: none;
}
.tc:nth-of-type(1){
display: block;
width: 100%;
height: 100%;
background-color: azure;
}
.tc:nth-of-type(2){
width: 100%;
height: 100%;
background-color: beige;
}
.tc:nth-of-type(3){
width: 100%;
height: 100%;
background-color: burlywood;
}
</style>
</head>
<body>
<div class="tab">
<div class="title">
<div class="tt">標(biāo)題1</div>
<div class="tt">標(biāo)題2</div>
<div class="tt">標(biāo)題3</div>
</div>
<div class="tab-content">
<div class="tc">內(nèi)容1</div>
<div class="tc">內(nèi)容2</div>
<div class="tc">內(nèi)容3</div>
</div>
</div>
<script>
let tts = document.getElementsByClassName("tt")
for(let i=0; i<tts.length; i++){
tts[i] . onmouseenter=function(){
console.log("鼠標(biāo)進(jìn)入了第"+ i +"個(gè)標(biāo)題")
let tcs =document.getElementsByClassName("tc")
for(let j=0;j<tcs.length;j++){
tcs[j].style.display="none"
}
tcs[i].style.display="block"
for(let x;x<tts.length;x++){
tts[x].classList="tt"
}
tts[i].classList="tt active"
}
}
</script>
</body>
</html>
2025-03-28 選項(xiàng)卡開(kāi)發(fā)
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- 隨著技術(shù)的發(fā)展,開(kāi)發(fā)的復(fù)雜度也越來(lái)越高,傳統(tǒng)開(kāi)發(fā)方式將一個(gè)系統(tǒng)做成了整塊應(yīng)用,經(jīng)常出現(xiàn)的情況就是一個(gè)小小的改動(dòng)或者...
- 鴻蒙應(yīng)用開(kāi)發(fā)從入門(mén)到入行 第八天 - Tabs選項(xiàng)卡 導(dǎo)讀:在本篇文章里,您將掌握使用Tabs選項(xiàng)卡做欄目分類(lèi),這...
- 1、index.wxml 2、index.wxss 3、index.js
- 概 述在上一篇博客中,我們學(xué)習(xí)了如何使用Hbuilder創(chuàng)建一個(gè)APP,同時(shí)如何使用MUI搭建屬于自己的第一款A(yù)P...