gpt4 book ai didi

css - 单击css时如何更改符号?

转载 作者:太空宇宙 更新时间:2023-11-03 22:27:06 25 4
gpt4 key购买 nike

如何在单击小部件标题时将符号更改为“V”,单击返回后小部件标题将变回符号“>”。

点击前图片:link

这是我在小部件标题后添加的 css。

.widgettitle a::after {
content: " >";
font-size:16px;
color:#d3db2c!important;
}

最佳答案

您必须使用复选框 hack 在纯 CSS 中实现此目的:

.link {
text-decoration: none;
}
.checkbox {
display: none;
}

.link:after {
content: '►';
margin-left: 5px;
display: inline-block;
}

.checkbox:checked ~ .link:after {
transform: rotate(90deg);
}
<div class="link-container">
<label for="checkbox-1">Click me</label>
<input type="checkbox" id="checkbox-1" class="checkbox">
<a href="#" class="link"></a>
</div>

关于css - 单击css时如何更改符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50508429/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com