HTML表格中第二列的位置不在右侧。
我有一张表,其中第一行有一列EXPECTED
,行宽度设置为 100%,其他两行有两列和宽该行设置为 90%(两列之间的空格应为10%)。
演示:
REALITY
<td style="positon: relative; right: 0; left: 5%;">
我试图符合我的期望:
snippet
LIVE DEMO(仅因为.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>
&#13;
AttributeError: type object 'User' has no attribute 'query'
&#13;
答案 0 :(得分:2)
右侧单元格中的Div与左侧对齐。
这将使它们浮动到右侧:
td:last-child div {
float:right;
}