【发布时间】:2022-01-20 02:35:40
【问题描述】:
<div class="tabs-tending">
<div class="tabs-tending-2">
<label for="tabs-tending-1"class="ten-mhead">TRENDING <span>|<span></label>
<input id="tabs-tending-1" name="tabs-two" type="radio" checked="checked">
<div>
<p>content</p>
</div>
</div>
<div class="tabs-tending-2">
<label for="tabs-tending-2" class="fav-mhead">FAVOURITES</label>
<input id="tabs-tending-2" name="tabs-two" type="radio">
<div>
<p>content</p>
</div>
</div>
</div>
我有一个带有内部选项卡内容的两个选项卡列表,切换时两个选项卡文本颜色相同,但我需要将活动选项卡文本颜色更改为黑色,非活动选项卡文本颜色将为灰色,我在 css 中尝试过但切换时看起来不一样,这里添加了html和css,请检查。提前致谢
.tabs-tending {
display: block;
display: -webkit-flex;
display: -moz-flex;
display: flex;
-webkit-flex-wrap: wrap;
-moz-flex-wrap: wrap;
flex-wrap: wrap;
margin: 0;
overflow: hidden; }
.tabs-tending [class^="tab"] label,
.tabs-tending [class*=" tab"] label {
color: #000000;
cursor: pointer;
display: block;
font-size: 1.0em;
font-weight: 600;
line-height: 1em;
padding: 0.5rem 0;
text-align: center; }
.tabs-tending [class*=" tab"] label {
color: #000000;
cursor: pointer;
display: block;
font-size: 1.0em;
font-weight: 600;
line-height: 1em;
padding: 0.5rem 0;
text-align: center; }
.tabs-tending [class^="tab"] [type="radio"],
.tabs-tending [class*=" tab"] [type="radio"] {
/* border-bottom: 1px solid rgba(239, 237, 239, 0.5); */
cursor: pointer;
-webkit-appearance: media-slider;
-moz-appearance: media-slider;
appearance: media-slider;
display: block;
width: 100%;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out; }
.tabs-tending [class^="tab"] [type="radio"]:hover,
.tabs-tending [class^="tab"] [type="radio"]:focus,
.tabs-tending [class*=" tab"] [type="radio"]:hover,
.tabs-tending [class*=" tab"] [type="radio"]:focus {
/* border-bottom: 1px solid #ffc20e; */}
.tabs-tending [class^="tab"] [type="radio"]:checked,
.tabs-tending [class*=" tab"] [type="radio"]:checked {
/* border-bottom: 2px solid #009297; */ }
.tabs-tending [class^="tab"] [type="radio"]:checked + div,
.tabs-tending [class*=" tab"] [type="radio"]:checked + div {
opacity: 1; }
.tabs-tending [class^="tab"] [type="radio"] + div,
.tabs-tending [class*=" tab"] [type="radio"] + div {
display: block;
opacity: 0;
padding: 0rem 0;
width: 90%;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out; }
.tabs-tending .tabs-tending-2 {
width: 50%; }
.tabs-tending .tabs-tending-2 [type="radio"] + div {
width: 200%;
margin-left: 200%; }
.tabs-tending .tabs-tending-2 [type="radio"]:checked + div {
margin-left: 0; }
.tabs-tending .tabs-tending-2:last-child [type="radio"] + div {
margin-left: 100%; }
.tabs-tending .tabs-tending-2:last-child [type="radio"]:checked + div {
margin-left: -100%; }
【问题讨论】:
-
找不到工作的 sn-p
-
感谢您的回复,并给予您及时的答复,非常感谢!...这里是冗长的html代码,为什么我没有添加,请您检查css代码
-
在标签上单击
tab中的库添加的类 -
这个类 .tabs-tending [class*=" tab"] label { color: #000000;光标:指针;显示:块;字体大小:1.0em;字体粗细:600;行高:1em;填充:0.5rem 0;文本对齐:居中;
-
显示完整的标签页 html