我想在一个html页面中并排创建两个div标签(div1和div2)。在div1中我创建了2个锚标签(创建和插入)。在div2中我想创建2个div选项卡(tab1和tab2)。我想解决创建到tab1并插入到tab2。有谁可以帮助我吗?
.container {
width: 80%;
height: 200px;
margin: auto;
padding: 10px;
}
.one {
width: 15%;
height: 200px;
float: left;
}
.two {
margin-left: 15%;
height: 200px;
}
<section class="container">
<div class="one">
<a href="tab1">Create</a>
<a href="tab2">Insert</a>
</div>
<div class="two">
<div class="tabs">
<div id="tab1">
<button class="tablinks" onclick="cpp">C++</button>
<button class="tablinks" onclick="java">java</button>
<div id="cpp" class="tabcontent">Create in C++</div>
<div id="java" class="tabcontent">Create in java</div>
</div>
<div id="tab2">
<button class="tablinks" onclick="cpp">C++</button>
<button class="tablinks" onclick="java">java</button>
<div id="cpp" class="tabcontent">Create in C++</div>
<div id="java" class="tabcontent">Create in java</div>
</div>
</div>
</div>
</section>
答案 0 :(得分:-1)
我希望,这段代码是完整的帮助
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li>
<li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li>
<li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">Messages</a></li>
<li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Settings</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="home">home</div>
<div role="tabpanel" class="tab-pane" id="profile">profile</div>
<div role="tabpanel" class="tab-pane" id="messages">message</div>
<div role="tabpanel" class="tab-pane" id="settings">settings</div>
</div>
</div>