【发布时间】:2021-05-08 11:09:06
【问题描述】:
我的codepen链接https://codepen.io/santoshch/pen/MWpYdXK
.tab1border{
border-right: 2px solid #f0f0f0;
}
.tab2border{
border-right: 2px solid #f0f0f0;
}
.tab3border{
border-right: 2px solid #f0f0f0;
}
.tab4border{
border-right: 2px solid #f0f0f0;
}
.tab5border{
border-right: 2px solid #f0f0f0;
}
.tab6border{
border-right: 2px solid #f0f0f0;
}
.container-prod {
z-index: 1;
background-color: #fff;
height: 50px;
width: 1000px;
position: absolute;
top: 205px;
left: 531px;
transform: translate(-50%, -50%);
font-size: 0;
border-radius: 3px;
overflow: hidden;
input {
display: none;
&:checked + label {
font-weight: 700;
color: #2241a6;
// background: #eee;
}
@for $i from 1 through 7 {
&#tab#{$i}:checked {
~ .line {
left: #{($i - 1) * 14.28%};
}
~ .content-container #c#{$i} {
opacity: 1;
}
}
}
}
label {
background-color: #fff;
display: inline-block;
font-size: 14px;
height: 50px;
line-height: 50px;
width: 142px;
text-align: center;
color: #555;
position: relative;
cursor: pointer;
padding: 0 10px;
&::after {
content: "";
height: 2px;
width: 100%;
position: absolute;
display: block;
bottom: 0;
opacity: 0;
left: 0;
}
&:hover::after {
opacity: 1;
}
}
.line {
position: absolute;
height: 16px;
border-bottom: 4px solid #2241a6;
width: 138px;
top: 34px;
left: 0;
}
.content-container {
background: #eee;
position: relative;
height: 100px;
font-size: 16px;
.content {
position: absolute;
padding: 10px;
width: 100%;
top: 0;
opacity: 0;
transition: 0.25s ease;
color: #333;
h3 {
font-weight: 200;
margin: 10px 0;
}
p {
margin: 10px 0;
}
p, i {
font-size: 13px;
}
}
}
}
<div class="container-prod">
<input type="radio" id="tab1" name="tab" checked />
<label for="tab1" class="tab1border">Hed</label>
<input type="radio" id="tab2" name="tab" />
<label for="tab2" class="tab2border">Col</label>
<input type="radio" id="tab3" name="tab" />
<label for="tab3" class="tab3border">Tars</label>
<input type="radio" id="tab4" name="tab" />
<label for="tab4" class="tab4border">Wre rods</label>
<input type="radio" id="tab5" name="tab" />
<label for="tab5" class="tab5border">ated</label>
<input type="radio" id="tab6" name="tab" />
<label for="tab6" class="tab6border">Color coed</label>
<input type="radio" id="tab7" name="tab" />
<label for="tab7">steel</label>
<div class="line"></div>
<div class="content-container">
<div class="content" id="c1">
<h3>Features</h3>
<p>There really are a lot of features.</p>
</div>
<div class="content" id="c2">
<h3>History</h3>
<p>The project started in 2018 when someone needed something.</p>
</div>
<div class="content" id="c3">
<h3>Reviews</h3>
<p>Amazing product. I don't know how it works.</p>
<i>- Anonymous</i>
</div>
<div class="content" id="c4">
<h3>Share</h3>
<p>This product is currently not shareable.</p>
</div>
<div class="content" id="c5">
<h3>Share</h3>
<p>This product is currently not shareable.</p>
</div>
<div class="content" id="c6">
<h3>Share</h3>
<p>This product is currently not shareable.</p>
</div>
<div class="content" id="c7">
<h3>Share</h3>
<p>This product is currently not shareable.</p>
</div>
</div>
</div>
我正在处理一个 css 选项卡,在每个选项卡的位置,我试图显示一些数据,但数据没有反映,不知道是什么原因导致每个选项卡没有显示数据。
如果我错了,请纠正我。
我的codepen链接https://codepen.io/santoshch/pen/MWpYdXK
【问题讨论】:
-
那么... Vue.js 代码在哪里?
-
@TJ 基本上我试图只使用 css 和 html。然后尝试在vuejs中实现逻辑。但在上面的代码中,只缺少一些逻辑。
-
这是我通过codepen.io/Chesswithsean/pen/jzYXjo的参考codepen链接@
标签: javascript html css vue.js