表格边框上的圆形,其中有文字

saj*_*adi 7 html css

我在创建自定义表的 html css 中遇到了很大的挑战在此处输入图片说明

我不知道在这种情况下创建我想在边界的垂直线上创建圆形我创建这个表。但这些是非常不同的:-D

table, th, td {
    border: 1px solid black;
    border-collapse: collapse;
    
}
.container {
  width: 100px;
  height: 1px;
  background-color: black;
  position: relative;
}
.circle {
  display: inline-block;
  vertical-align: middle;
  width: 40px;
  height: 40px;
  background-color: white;
  border: solid 1px black;
  border-radius: 50%;
  position: absolute;
  top: -6px;
  left: calc(50% - 5px);
}
Run Code Online (Sandbox Code Playgroud)
<table style="width:100%">
  <tr>
    <th>Firstname</th>
    <th>Lastname</th> 
    <th>Age</th>
  </tr>
  <tr>
    <td>Eve</td>
    <td>
      <div class="container">
        <div class="circle">test</div>
      </div>
    </td> 
    <td>94</td>
  </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

小智 0

这段代码

尝试一下:

<html>
    <table style="width:100%">
        <tr>
          <th>Firstname</th>
          <th>Lastname</th> 
          <th>Age</th>
        </tr>
        <tr>
            <td>Eve</td>
            <td style="width: 100px;height: 100px;">      <div class="row">
                <div class="large-8 large-centered">
                  <div class="wrapper">
                    <div class="vertical-line"></div> 
                    <div class="circle">
                      <h5>Some Text</h5>
                    </div>
                    <div class="vertical-line"></div> 
                  </div>
                </div>
              </div>
            </td> 
            <td>94</td>
          </tr>


      </table>


      <style>
table, th, td {
    border: 1px solid black;
    border-collapse: collapse;
    
}
.wrapper {
  width: auto;
  height: auto;
}

.circle {
  width: 50px;
  height: 50px;
  border-style: solid;
  border-color: #000000;
  border-radius: 100px;
  position: relative;
  margin: 0 auto 0 auto;
}

h5 {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  color: #000000;
}

.vertical-line {
  width: 2px;
  height: 100px;
  background: #2ecc71;
  margin: 0 auto 0 ;
}

hr {
  border: 0;
  height: 1px;
  background: #333;
  background: linear-gradient(to right, #ccc, #333, #ccc);
}
      </style>
</html>
Run Code Online (Sandbox Code Playgroud)