如何防止工具提示在表格中创建垂直滚动条?

问题描述 投票:0回答:0

我创建了一个表格,其中嵌入了工具提示。在表格底部附近,工具提示悬停的长度会在表格中创建一个永久的垂直滚动条以适合工具提示。但是我希望工具提示只是重叠在表格底部之外。我错过了什么?

工具提示 CSS:

span.tooltip {
  position: relative;
  display: inline;
  border-bottom: 1px dotted white;
}

span.tooltip span {
  opacity: 0.8;
  top: 30px;
  left: calc(50% - 23px);
  margin-left: -50%;
  position: absolute;
  color: #FFFFFF;
  background: #000000;
  line-height: 30px;
  text-align: center;
  visibility: hidden;
  border-radius: 6px;
  box-shadow: 0px 0px 0px #800000;
  width: auto;
  height: auto;
  padding: 0 10px;
  white-space: nowrap;
}

span.tooltip span:after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-left: -8px;
  width: 0; 
  height: 0;
  border-bottom: 8px solid #000000;
  border-right: 8px solid transparent;
  border-left: 8px solid transparent;
}

span:hover.tooltip span {
  visibility: visible;
  opacity: 1;
  top: 30px;
  left: calc(50% - 23px);
  margin-left: -50%;
  z-index: 999;
}

和表格 CSS:

table.my-table.delivery-payment-table {
  border-collapse: collapse;
  width: 100%;
  font-family: Comfortaa, sans-serif;
  text-align: center;
}

table.my-table th {
  background-color: #303030;
  color: white;
  font-size: 105%;
}

table.my-table th, table.my-table td {
  text-align: center;
  border-right: 1px dotted white;
  vertical-align: middle;
  padding: 8px;
}

table.my-table th:first-child,
table.my-table td:first-child {
  text-align: center;
  min-width: 150px;
}

table.my-table th:last-child,
table.my-table td:last-child {
  border-right: none;
}

table.my-table tr {
  border-bottom: 1px solid white;
}

table.my-table tr:nth-child(even) td {
  background-color: #606060;
  color: white;
}

table.my-table tr:nth-child(odd) td {
  background-color: #707070;
  color: white;
}

table.my-table tr:last-child {
  border-bottom: none;
}

table.my-table tbody tr:nth-child(n+1):nth-child(-n+4) td:first-child {
  font-size: 85%;
}

@media screen and (max-width: 600px) {
  table.my-table {
    width: 100%;
  }
}

我尝试将

overflow: visible;
z-index: 9999;
添加到 span.tooltip,但似乎没有任何效果。

css tooltip overflow z-index css-tables
© www.soinside.com 2019 - 2024. All rights reserved.