html - Bootstrap 表推送侧边菜单并获取字宽

标签 html css bootstrap-table

我的问题是我无法让表格和侧边菜单在 Bootstrap 列中正常运行,如图所示。我尝试了一些不同的东西,但没有任何帮助。我希望表格和侧边菜单能够响应,但我不明白为什么表格会把其他内容推开。 我希望表格填充 7 列,侧面菜单填充 3 列。

希望对您有所帮助!

Image

.vertical-menu {
    font-family: 'Roboto';
}

.vertical-menu a {
    background-color: #eee; 
    color: black; 
    display: block; 
    padding: 12px; 
    text-decoration: none; 
}

.vertical-menu a:hover {
    background-color: #ccc; 
}

.vertical-menu a.active {
    background-color: #4CAF50;  
    color: white;
}

#coin{
	 text-align: center; 
	 background-color: #343434;
	 color: #FFF;
	 padding: 10px;
	 margin: 0;
	 border-top-right-radius: 12px;
	 font-family: 'Roboto';	


}

.main {
	display:inline-block;
	height: auto;
}

.content {
	}

.table {
	width: 800px;
}

.main h3 {
	margin-left: 390px;
	font-family: 'Roboto';
	margin-top: 40px; 
}
<div class="main">
	<div class="row">
		<div class="col-md-3">

<div class="vertical-menu" >
	<h5 id="coin">Coins</h5>
  <a href="#" class="active">BTC</a>
  <a href="#">BitC</a>
  <a href="#">Eth</a>
  <a href="#">LightC</a>
  <a href="#">iota</a>
  <a href="#">ripple</a>
  <a href="#">Verge</a>
  <a href="#">Cardano</a>
  <a href="#">NEM</a>
  <a href="#">TRON</a>
  <a href="#">Dash</a>
  <a href="#">EOS</a>
  <a href="#">NEO</a>
  <a href="#">Monero</a>
  <a href="#">Qtum</a>
</div>
</div>
<div class="col-md-9">
<h3>Bitcoin</h3>


<table class="table table-hover table-responsive">
  <thead>
    <tr>
      <th>#</th>
      <th>First Name</th>
      <th>Last Name</th>
      <th>Username</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>Mark</td>
      <td>Otto</td>
      <td>@mdo</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>Jacob</td>
      <td>Thornton</td>
      <td>@fat</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td>Larry</td>
      <td>the Bird</td>
      <td>@twitter</td>
    </tr>
  </tbody>
</table>
</div>
</div>
</div>

最佳答案

将其包装在具有类表响应的 div 中

<div class="table-responsive">
  <table class="table">
    ...
  </table>
</div>

关于html - Bootstrap 表推送侧边菜单并获取字宽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48130293/

相关文章:

jquery - div的深色透明 mask

javascript - 可拖动功能不起作用

html - 列表样式在不同的浏览器中呈现不同的外观

html - 段落中的 "text-indent"如何申请?

jquery - CSS - jQuery 隐藏/显示 div 改变高度

html - 在显示消息时引入延迟。过渡延迟属性不起作用

javascript - 类的单选按钮单击了jquery

jquery - 如何设置默认取消选中引导表中的所有项目?

javascript - bootstrap-table header 和 body 对齐方式不匹配

javascript - 基于值的 Bootstrap 表格单元格颜色