【发布时间】:2018-10-11 18:48:16
【问题描述】:
HTML表格行中第二列的位置不在右侧。
我有一个表格,其中第一行有一个单独的列 colspan="2" 并且行的宽度设置为 100%,其他两行有两列和宽度行设置为 90%(两列之间的空白应为 10%)。
演示:
EXPECTED:
REALITY:
我试图达到我的期望:
<td style="positon: relative; right: 0; left: 5%;">
LIVE DEMO(只是因为snippet没有给出实际结果)
完整代码:
.hidden_timer {
visibility: hidden;
}
.visible {
visibility: visible !important
}
.question1 {
display: flex;
align-items: center;
width: 90%;
height: auto;
min-height: 40px;
position: relative;
background: blue;
color: white;
}
.question1::after {
content: "";
position: absolute;
left: -20px;
bottom: 0;
width: 0;
height: 0;
border-right: 20px solid blue;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.question1::before {
content: "";
position: absolute;
right: -20px;
bottom: 0;
width: 0;
height: 0;
border-left: 20px solid blue;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
}
.table_cstm {
border-collapse: separate;
border-spacing: 15;
/* Apply cell spacing */
}
<link rel="stylesheet" href="http://docstore.co.in/kbc/style/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="container">
<table id="test" class="table table-responsive table_cstm">
<tbody>
<tr>
<td colspan="2">
<div class="question1" style="justify-content: center; width: 100%;">Who was First President of India?(15204)</div>
</td>
</tr>
<tr>
<td>
<div id="A1" class="question1" onclick="onSelect(event)">A) M K Gandhi
</div>
</td>
<td style="positon: relative; right: 0; left: 5%;">
<div id="B1" class="question1" onclick="onSelect(event)">B) Jawaharlal Nehru
</div>
</td>
</tr>
<tr>
<td>
<div id="C1" class="question1" onclick="onSelect(event)">C) Rajendra Prasad
</div>
</td>
<td style="positon: relative; right: 0; left: 5%;">
<div id="D1" class="question1" onclick="onSelect(event)">D) Chandra Shekhar Azad
</div>
</td>
</tr>
</tbody>
</table>
【问题讨论】:
标签: html css twitter-bootstrap html-table