html - 删除使用 d3 创建的表中的列空间

标签 html css d3.js whitespace css-tables

我想删除 d3 表中的列空间。我需要删除下图中红线右侧的所有内容,并确保数据仅适合 div。它似乎增加了比所需空间更多的空间。感谢您的帮助

Remove to the right of red line

下面概述了我使用的代码。请参阅下面的 html 和 css 代码。

html

<!DOCTYPE html>
<html>
  <head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="styles.css">
  </head>

  <body>
    <div class="grid-container">
      <div class="map">
        <svg></svg>
      </div>
      <div class="box-plot">
        <svg></svg>
      </div>
      <div class="table"></div>
      <div class="line-chart">
        <svg></svg>
      </div>
    </div>

    <script src="bundle.js"></script>
  </body>
</html>

/* 和 css*/

.map {
  grid-area: map;
}

.map-path {
  /* fill: rgba(0,0,0,0.01); */
  /* stroke: rgba(0,0,0,0.2); */
  /* stroke-width: 1px; */
}

.map-path.counties {
  stroke: black;
  stroke-width: 1px;
}

.map-path.catchments {
  stroke: black;
  stroke-width: 1px;
}

.map-path.aquifer {
  /* stroke: rgba(0,200,0,0.5); */
  /* stroke-width: 0.5px; */
}

.map-path.gwrockunit {
  /* stroke: rgba(200,0,0,0.5); */
  /* stroke-width: 0.5px; */
}

.map-path.selected-basemap-polygon {
  stroke: black;
  stroke-width: 2px;
}

.box-plot {
  grid-area: box-plot;
}

.table {
  grid-area: table;
  overflow-y: scroll;
  font-family: Courier;
  /* max-width: 400px; */
  border-collapse: collapse;
  white-space: nowrap;
  width: 100%;
}
tr:nth-of-type(odd) {
        background: #eee;
}
th {
    background: #333;
    color: white;
    font-weight: bold;
    cursor: s-resize;
    background-repeat: no-repeat;
      background-position: 3% center;
}
td, th {
  padding: 6px;
  border: 1px solid #ccc;
  text-align: left;
}

.line-chart {
  grid-area: line-chart;
}

.grid-container {
  position: fixed;
  left: 0px;
  right: 0px;
  top: 0px;
  bottom: 0px;
  display: grid;
  grid-template-areas:
    'map map box-plot table'
    'map map line-chart table';
  grid-gap: 10px;
  background-color: #2196F3;
  padding: 10px;
}

.grid-container div {
  background-color: white;
}

.grid-container div svg {

  /* This makes it so the grid does not resize when the SVG is added */
  position: absolute;
}

.basemap-selector-widget {
  cursor: pointer;
}

.basemap-selector-widget rect {
  fill: white;
  stroke: black;
  stroke-width: 2px;
  border-radius: 25px;
}

.basemap-selector-widget text {
  font-family: sans;
  alignment-baseline: middle;
  text-anchor: middle;
}

最佳答案

覆盖此规则:.table{ width: 100%; } 类似 width: auto

关于html - 删除使用 d3 创建的表中的列空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51947093/

相关文章:

javascript - 使用第一个 jQuery-CSS 选项卡中的链接转到第三个选项卡并防止页面刷新时选项卡切换

html - CSS 中的伪类 hover

javascript - DataMaps.js - 网络天气 map (入站和出站弧线)

javascript - D3 为单个 json 生成多个图

javascript - d3js 图表区域外的网格

javascript - 单选按钮值的返回类型是整数还是字符串

javascript - html中选项卡式布局的最佳实践

css - 在 chrome 中调整窗口大小时字体不显示

html - 设置布局条件 - CSS

php - 获取一篇文章的内容