html - 可以在列之间创建一个带有三 Angular 形的表头吗?

标签 html css header

我正在尝试创建一个自定义表格标题,在列之间带有箭头,如下图所示。谁知道该怎么做?

代码:

  .table tr {
      cursor: pointer;
  }
    .im-header {
    width: 20%;
    text-align:center;
    cursor: default;
  }
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" rel="stylesheet"/>
<table class="table" style="border-collapse:collapse;">
<thead class="thead-dark">
<tr>
	<th scope="col" class="im-header"></th>
	<th scope="col" class="im-header">Konceptualisering</th>
	<th scope="col" class="im-header">Proof of concept</th>
	<th scope="col" class="im-header">Produktvalidering</th>
	<th scope="col" class="im-header">Produktlansering</th>
</tr>
</thead>
</table>

enter image description here

最佳答案

.nav-wrap {
  border: 1px solid green;
  position: relative;
}

.nav-wrap ul {
  display: table;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

.nav-wrap ul li {
  background: #fff;
  border-right: 1px solid green;
  display: table-cell;
  vertical-align: middle;
  width: 1%;
  height: 50px;
}

.nav-wrap ul li:last-child,
.nav-wrap ul li.active {
  border-right: none;
}

.nav-wrap ul li.active {
  background: green;
}

.nav-wrap ul li .step:before,
.nav-wrap ul li .step:after {
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  content: "";
  display: none;
  margin: -10px 0 0 0;
  position: absolute;
  top: 50%;
}

.nav-wrap ul li:last-child .step:before,
.nav-wrap ul li:last-child .step:after {
  display: none;
}

.nav-wrap ul li .step:before {
  border-left: 10px solid green;
  right: -10px;
  z-index: 2;
}

.nav-wrap ul li.active .step:before {
  border-left: 10px solid green;
}

.nav-wrap ul li .step:after {
  border-left: 10px solid green;
  right: -11px;
  z-index: 1;
}

.nav-wrap ul li .step {
  box-sizing: border-box;
  display: block;
  font-size: 10px !important;
  font-weight: bold;
  line-height: 12px !important;
  padding: 9px 0;
  position: relative;
  text-align: center;
}

.nav-wrap ul li .step span {
  display: block;
  font-size: 12px !important;
  font-weight: bold;
  line-height: 12px !important;
  z-index: 3;
}

.nav-wrap ul li .step span {
  color: #000;
}

.nav-wrap ul li.active .step span {
  position: static;
}

.nav-wrap ul li .step:before,
.nav-wrap ul li .step:after {
  border-top: 25px solid transparent;
  border-bottom: 25px solid transparent;
  display: block;
  margin: -25px 0 0 0;
}

.nav-wrap ul li .step:before {
  border-left: 25px solid #fff;
  right: -25px;
}

.nav-wrap ul li.active .step:before {
  border-left: 25px solid green;
}

.nav-wrap ul li .step:after {
  border-left: 25px solid green;
  right: -26px;
}

.nav-wrap ul li .step span,
{
  left: 12px;
  position: relative;
  top: auto;
}

.nav-wrap ul li:first-child .step span,
{
  left: 0;
}
<div class="nav-wrap">
  <ul>
    <li class="active"><span class="step"><span>Select</span></span>
    </li>
    <li><span class="step"><span>Confirm</span></span>
    </li>
    <li><span class="step"><span>Finish</span></span>
    </li>
  </ul>
</div>

此解决方案使用 div,但您应该能够满足您的需求。

关于html - 可以在列之间创建一个带有三 Angular 形的表头吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56242075/

相关文章:

html - 如何在 html/css 中 float div 包装器?

html - 为什么这个元素在移动?

c - 如何用 C 语言创建通用的个性化函数,然后将它们包含在您的程序中?

ios - 在 dylib 中使用 header 进行编译

html - 如何在容器中垂直居中行?

html - 类别/子类别列表的 CSS 样式

Javascript 隐藏一个 div,直到你点击一个按钮,需要帮助修改

javascript - 使用 jquery 文本框值小于两个字母(数字)值在前面加上 0

html - 标题下的边栏和正文 "hiding"

javascript - 在库中包含 <div></div>