参考,要点击展开需要结合js,帮助到你可以点击采纳支持下哦,谢谢~~
<style>
.arrowleft {
display: inline-block;
width: 0;
height: 0;
border-top: 5px solid transparent;
border-left: 5px solid #000;
border-bottom: 5px solid transparent;
}
div.tab em {
margin-right: 5px
}
div.tab .content {
display: none
}
div.tabopen .content {
display: block
}
div.tabopen .arrowleft {
display: inline-block;
width: 0;
height: 0;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-top: 5px solid #000;
border-bottom: initial;
vertical-align: middle
}
</style>
<div>
<div class="tab tabopen">
<div class="title"><em class="arrowleft"></em>动作电影</div>
<div class="content">动作电影详情</div>
</div>
<div class="tab">
<div class="title"><em class="arrowleft"></em>科幻电影</div>
<div class="content">科幻电影详情</div>
</div>
<div class="tab">
<div class="title"><em class="arrowleft"></em>激情电影</div>
<div class="content">激情电影详情</div>
</div>
</div>
<script src="https://g.csdnimg.cn/??lib/jquery/1.12.4/jquery.min.js"></script>
<script>
$('.tab .title').click(function () { $(this).parent().toggleClass('tabopen').siblings().removeClass('tabopen') })
</script>
<style type="text/css">
.box li {
list-style-type: none;
}
.box li:before {
content: "";
display: inline-block;
float: left;
width: 0;
height: 0;
border-top: 5px solid transparent;
border-left: 10px solid #000;
border-bottom: 5px solid transparent;
}
.box li.ck:before {
transform: rotate(90deg);
}
</style>
</head>
<body>
<ul class="box">
<li>AAAAA
</li>
<li class="ck">BBBBB
</li>
</ul>
#triangle-right {
width: 0;
height: 0;
border-top: 50px solid transparent;
border-left: 100px solid red;
border-bottom: 50px solid transparent;
}
#triangle-bottomleft {
width: 0;
height: 0;
border-bottom: 100px solid red;
border-right: 100px solid transparent;
}
这两段代码会给你一个启示的,特别是上面的
点击事件,动态切换类名就好
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.arrow_top {
width: 0;
height: 0;
border-bottom: 30px solid #ff7f0b;
/* border: 30px solid #ff7f0b; */
border-left: 30px solid transparent;
border-right: 30px solid transparent;
font-size: 0;
line-height: 0;
}
.arrow_right {
width: 0;
height: 0;
border-left: 30px solid transparent;
border-right: 30px solid transparent;
border-bottom: 30px solid #ff7f0b;
font-size: 0;
line-height: 0;
transform: rotate(90deg);
}
.arrow_bottom {
width: 0;
height: 0;
border-left: 30px solid transparent;
border-right: 30px solid transparent;
border-bottom: 30px solid #ff7f0b;
font-size: 0;
line-height: 0;
transform: rotate(180deg);
}
.arrow_left {
width: 0;
height: 0;
border-left: 30px solid transparent;
border-right: 30px solid transparent;
border-bottom: 30px solid #ff7f0b;
font-size: 0;
line-height: 0;
transform: rotate(270deg);
}
</style>
</head>
<body>
<p class="arrow_top"></p> <br>
<p class="arrow_right"></p><br>
<p class="arrow_bottom"></p><br>
<p class="arrow_left"></p><br><br>
</body>
</html>
完整代码如下:{如果对你有帮助,可以点给我个采纳吗,谢谢}。
结合jquery实现点击展开功能
<!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,chrome=1" />
<title> 页面名称 </title>
<style type="text/css">
.box li {
list-style-type: none;
}
.box li:before {
content: "";
display: inline-block;
float: left;
width: 0;
height: 0;
margin-right: 5px;
border-top: 7px solid transparent;
border-left: 7px solid #000;
border-bottom: 7px solid transparent;
}
.box > li > div {
display: none;
}
.box li.ck:before {
transform: rotate(90deg);
}
.box > li.ck > div {
display: block;
}
</style>
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<ul class="box">
<li><h5>AAAAA</h5>
<div>aaaaaa</div>
</li>
<li><h5>BBBBB</h5>
<div>bbbbbb</div>
</li>
</ul>
<script type="text/javascript">
$(function(){
$(".box h5").click(function(event){
$(this).parent().toggleClass("ck");
});
});
</script>
</body>
</html>
您的问题已经有小伙伴解答了,请点击【采纳】按钮,采纳帮您提供解决思路的答案,给回答的人一些鼓励哦~~
ps:开通问答VIP,享受5次/月 有问必答服务,了解详情↓↓↓
【电脑端】戳>>> https://vip.csdn.net/askvip?utm_source=1146287632
【APP 】 戳>>> https://mall.csdn.net/item/52471?utm_source=1146287632