gpt4 book ai didi

html - 使三个选项卡填充容器的宽度

转载 作者:太空宇宙 更新时间:2023-11-04 13:29:57 25 4
gpt4 key购买 nike

我试图让三个“选项卡”填满一个更大的容器 div 的整个宽度,但宽度总是短几个像素,或者如果我增加选项卡的宽度,最后一个被推到较低的水平.另外,li 元素是否更适合构建这些选项卡?我正在使用 bootstrap,如果是这样的话,如果您知道它有一个内置的解决方案,我非常愿意这样做。

JSBIN

<!--HTML-->
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div class="vendor_container">
<div class="vendor_header">
<span>
Company
</span>
</div>

<div class="vendor_tabs">
<div class="vendor_tab vendor_contacts">
Contacts
</div>
<div class="vendor_tab vendor_clients">
Clients
</div>
<div class="vendor_tab vendor_notes">
Notes
</div>
<div class="clear"></div>
</div>
<div class="vendor_pane vendor_contacts">
<table class="detail_table contacts">
<thead>
<tr>
<th>
Name
</th>
<th>
email
</td>
<th>
Phone
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Dave Sample
</td>
<td>
dsample@sample.com
</td>
<td>
555.123.1234
</td>
<td>
<a href="#" class="edit_contact">
Edit
</a>
</td>
</tr>
<tr>
<td>
Jill Sample
</td>
<td>
jsample@sample.com
</td>
<td>
555.123.1234
</td>
<td>
<a href="#" class="edit_contact">
Edit
</a>
</td>
</tr>
<tr>
<td>
Irene Sample
</td>
<td>
isample@sample.com
</td>
<td>
555.123.1234
</td>
<td>
<a href="#" class="edit_contact">
Edit
</a>
</td>
</tr>
</tbody>
</table>

</div>

<div class="vendor_pane vendor_contacts">
<table class="detail_table vendor_clients">
<thead>
<tr>
<th>
Client
</th>
<th>
ID
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Sample 1
</td>
<td>
1234
</td>
</tr>
<tr>
<td>
sample 2
</td>
<td>
9874
</td>
</tr>
</tbody>
</table>
</div>

<div class="vendor_pane vendor_notes">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>



</body>
</html>

/CSS/

body{
margin:5px;
}
.vendor_container{
width: 100%;
max-width:1040px;
}
.vendor_header{

}
.vendor_header, .vendor_tab, th{
text-align:center;
}
.vendor_tab{
float:left;
width:33%;
padding: 5px 0 12px;
border-color: gray;
border-style:solid;
border-width:1px 1px 0 0;
}
.vendor_tab:first-of-type{
border-left-width:1px;
}
.border_left{
border-left-width: 1px;
}
.clear{
clear:both;
}
.vendor_pane ~.vendor_pane{
display:none;
}
.vendor_pane table{
width:100%;
}
.vendor_pane{
width:100%;
border:1px solid gray;
}

最佳答案

Bootstrap 在 nav-tabs 部分下包含一个“justified”选项。

查看文档 here .但是,如果您只想使用他们的 CSS

*{
box-sizing:border-box;
}
.vendor_tab{
display: table-cell;
width: 1%;
padding: 5px 0 12px;
border-color: gray;
border-style:solid;
border-width:1px 1px 0 0;
}

JSFiddle Demo

附言。 tabified your HTML

关于html - 使三个选项卡填充容器的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23430804/

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