如何创建这样的水平标签:http://i.imgur.com/m81yupV.png?
代码:
<label class="formlabel">Title 1:</label>
<div id="radio_form">
<label><input type="radio" value="1" name="status">Activated</label>
<br>
<label><input type="radio" value="0" name="status">Deactivated</label>
<br><br>
</div>
<label class="formlabel">Title 2:</label>
<input name="input2" type="text" class="forminput" />
<label class="formlabel">Title 3:</label>
<input name="input3" type="text" class="forminput" />
<input class="formsubmit" type="submit" name ='submit' value="Save">
我想在标签2上有标题/输入3,例如,我可以用CSS使用div和样式吗?
如果有人拥有包含jQuery或JavaScript的解决方案,请分享。
我希望有人可以提前帮助。
答案 0 :(得分:2)
所有内容均在https://jqueryui.com/tabs/
解释<script>
$(function() {
$( "#tabs" ).tabs();
});
</script>
<div id="tabs">
<ul>
<li><a href="#tabs-1">Nunc tincidunt</a></li>
<li><a href="#tabs-2">Proin dolor</a></li>
<li><a href="#tabs-3">Aenean lacinia</a></li>
</ul>
<div id="tabs-1">
<p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
</div>
<div id="tabs-2">
<p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
</div>
<div id="tabs-3">
<p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p>
<p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
</div>
</div>
答案 1 :(得分:0)
你可以使用
<div class="container">
<h3>Tabs</h3>
<ul class="nav nav-tabs">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Menu 1</a></li>
<li><a href="#">Menu 2</a></li>
<li><a href="#">Menu 3</a></li>
</ul></div>
答案 2 :(得分:0)
使用expireat,简单易用,您可以使用prebuild样式或随CSS更改。
答案 3 :(得分:0)
我想说试一试MetroUI
这是example
<div class="tabcontrol" data-role="tabControl" data-open-target="#frame_3_2">
<ul class="tabs">
<li class="active"><a href="#frame_3_1">Tab 1</a>
</li>
<li class=""><a href="#frame_3_2">Tab 2</a>
</li>
<li class=""><a href="#frame_3_3">Tab 3</a>
</li>
</ul>
<div class="frames bg-grayLight">
<div class="frame" id="frame_3_1" style="display: block;">1</div>
<div class="frame" id="frame_3_2" style="display: none;">2</div>
<div class="frame" id="frame_3_3" style="display: none;">3</div>
</div>
</div>
答案 4 :(得分:0)
请参阅:FIDDLE
<强> HTML 强>
<!--custom tab-->
<div class="tab"> <a target="1" class="active">HOME</a>
<a target="2">PERSONAL</a>
<a target="3">EDUCATIONAL</a>
</div>
<div class="details" id="link1">Home details goes here</div>
<div class="details" id="link2" style="display:none;">Personal details goes here</div>
<div class="details" id="link3" style="display:none;">Educational details goes here</div>
<强> Jquery的强>
$(".tab a").click(function () {
$(".tab a").removeClass('active');
$(this).addClass('active');
$(".details").hide();
var target = $(this).attr('target');
$("#link" + target).show();
});
答案 5 :(得分:0)
我提出了这个解决方案
$('#tabs li a').click(function() {
$('#tabs li a').removeClass("selected_tab");
$(this).addClass("selected_tab");
});
&#13;
#tabs {
list-style:none;
display:block;
overflow:hidden;
margin:0;
}
#tabs li {
float:left;
margin-right:0.5em;
border: 1px solid black;
border-bottom:0;
}
#tabs li a {
display:block;
padding:0.3em;
color:#000;
text-decoration:none;
border-bottom: 1px solid #000;
}
.selected_tab {
border-bottom: 1px solid #fff !important;
}
#tab_content {
width:100%;
border-top:1px solid #000;
margin-top:-1px;
}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ul id="tabs">
<li><a class="selected_tab" href="#tab1">Tab 1</a></li>
<li><a href="#tab2">Tab 2</a></li>
</ul>
<div id="tab_content">asdsda</div>
&#13;