我在设计中使用自定义样式的复选框。复选框完美地工作,因为它们被设计为在我的Windows笔记本电脑上进行(在chrome和IE中测试);但是,在我的ipad和iphone上,复选框使表格标题向下移动。点击复选框的次数越多,字幕下方的字幕越多。
我花了很多时间修改代码,无法想出发生这种情况的原因。
这可能发生在Mac计算机上以及运行Safari。我不确定,因为我无法测试
html {
margin: 0;
padding: 0;
}
body {
margin: 0;
padding: 0;
font-family: 'Open Sans', sans-serif;
font-size: 1em;
margin-top: 40px;
}
table {
margin: 0;
padding: 0;
border-collapse: collapse;
}
.margin5 {
margin: 5px;
}
.clear {
float: left;
width: 100%;
clear: both;
}
.table-full {
width: 100%;
}
.table-condensed>thead>tr>th,
.table-condensed>tbody>tr>th,
.table-condensed>tfoot>tr>th,
.table-condensed>thead>tr>td,
.table-condensed>tbody>tr>td,
.table-condensed>tfoot>tr>td {
border: 1px solid #000 !important;
text-align: center;
}
.table-bordered caption {
border: 1px solid #000;
}
caption.firstheading {
background: #062D6A;
color: #fff;
font-weight: bold;
font-size: 1.1em;
text-align: center;
}
caption.secondheading {
background: #1d8cb8;
color: #fff;
font-weight: bold;
font-size: 1em;
text-align: center;
}
.header2 {
font-size: .85em;
font-weight: bold;
background: #E0E0E0;
}
table {
background-color: transparent;
}
caption {
padding-top: 8px;
padding-bottom: 8px;
color: #777;
text-align: left;
}
th {
text-align: left;
}
.table {
margin-bottom: 20px;
}
.table>thead>tr>th,
.table>tbody>tr>th,
.table>tfoot>tr>th,
.table>thead>tr>td,
.table>tbody>tr>td,
.table>tfoot>tr>td {
padding: 8px;
line-height: 1.42857143;
vertical-align: top;
border-top: 1px solid #ddd;
}
.table>thead>tr>th {
vertical-align: bottom;
border-bottom: 2px solid #ddd;
}
.table>caption+thead>tr:first-child>th,
.table>colgroup+thead>tr:first-child>th,
.table>thead:first-child>tr:first-child>th,
.table>caption+thead>tr:first-child>td,
.table>colgroup+thead>tr:first-child>td,
.table>thead:first-child>tr:first-child>td {
border-top: 0;
}
.table-condensed>thead>tr>th,
.table-condensed>tbody>tr>th,
.table-condensed>tfoot>tr>th,
.table-condensed>thead>tr>td,
.table-condensed>tbody>tr>td,
.table-condensed>tfoot>tr>td {
padding: 5px;
}
.table-bordered {
border: 1px solid #ddd;
}
.table-bordered>thead>tr>th,
.table-bordered>tbody>tr>th,
.table-bordered>tfoot>tr>th,
.table-bordered>thead>tr>td,
.table-bordered>tbody>tr>td,
.table-bordered>tfoot>tr>td {
border: 1px solid #ddd;
}
.table-bordered>thead>tr>th,
.table-bordered>thead>tr>td {
border-bottom-width: 2px;
}
.table-responsive {
min-height: .01%;
overflow-x: auto;
}
form.formatted {
float: left;
width: 100%;
margin: 20px 0;
}
form.formatted label {
display: block;
margin-bottom: 8px;
}
form.formatted #checkbox {}
form.formatted #checkbox_label {}
form.formatted input[type="checkbox"] {
visibility: hidden;
}
form.formatted .checkbox {
clear: left;
position: relative;
float: left;
}
form.formatted input[type="checkbox"] {
width: auto;
opacity: 0.00000001;
position: absolute;
left: 0;
margin-left: -20px;
}
form.formatted .helper {
position: absolute;
top: 0px;
left: 0px;
cursor: pointer;
display: block;
font-size: 30px;
color: #1d8cb8;
}
form.formatted .helper:before {
content: '';
position: absolute;
left: 0;
top: 0;
margin: 4px;
width: 30px;
height: 30px;
transition: transform 0.28s ease;
border-radius: 3px;
border: 1px solid #000;
background: #fff;
}
form.formatted .helper:after {
content: '';
display: block;
width: 15px;
height: 7px;
border-bottom: 2px solid #1d8cb8;
border-left: 2px solid #1d8cb8;
-webkit-transform: rotate(-45deg) scale(0);
-moz-transform: rotate(-45deg) scale(0);
-ms-transform: rotate(-45deg) scale(0);
transform: rotate(-45deg) scale(0);
position: absolute;
top: 12px;
left: 10px;
}
form.formatted input[type="checkbox"]:checked~.helper::before {
color: #1d8cb8;
}
form.formatted input[type="checkbox"]:checked~.helper::after {
-webkit-transform: rotate(-45deg) scale(1);
-moz-transform: rotate(-45deg) scale(1);
-ms-transform: rotate(-45deg) scale(1);
transform: rotate(-45deg) scale(1);
}
form.formatted .checkbox label {
height: 40px;
padding-left: 50px;
margin-top: 10px;
margin-bottom: 0;
font-weight: normal;
cursor: pointer;
vertical-align: sub;
}
form.formatted input[type="checkbox"]:focus+label::before {
outline: rgb(59, 153, 252) auto 5px;
}

<form class="formatted">
<table class="table-full table-condensed table-bordered">
<caption class="firstheading">CAPTION</caption>
<caption class="secondheading"><i>CAPTION LINE 2</i></caption>
<thead>
<tr class="header2">
<th>
<div class="margin5">COL 1</div>
</th>
<th>
<div class="margin5">COL 2</div>
</th>
<th>
<div class="margin5">COL 3</div>
</th>
<th>
<div class="margin5">COL 4</div>
</th>
<th>
<div class="margin5">COL 5</div>
</th>
<th>
<div class="margin5">COL 6</div>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<div class="margin5"><b>TABLE CONTENT</b></div>
</td>
<td>
<div class="margin5"><b>BLAH BLAH</b></div>
</td>
<td>
<div class="margin5"><b>TABLE CONTENT</b></div>
</td>
<td>
<div class="margin5"><b>BLAH BLAH</b></div>
</td>
<td>
<div class="margin5"><b>TABLE CONTENT</b></div>
</td>
<td>
<div class="margin5"><b>BLAH BLAH</b></div>
</td>
</tr>
<tr>
<td>
<div class="margin5"><b>BLAH BLAH</b></div>
</td>
<td>
<div class="margin5"><b>TABLE CONTENT</b></div>
</td>
<td>
<div class="margin5"><b>BLAH BLAH</b></div>
</td>
<td>
<div class="margin5"><b>TABLE CONTENT</b></div>
</td>
<td>
<div class="margin5"><b>BLAH BLAH</b></div>
</td>
<td>
<div class="margin5"><b>TABLE CONTENT</b></div>
</td>
</tr>
<tr>
<td colspan="6">
<div class="margin5">
<div class="clear"><br /></div>
</div>
</td>
</tr>
<tr>
<td class="td-left" colspan="6">
<div class="margin5">
<div class="checkbox"><label><input type="checkbox" name="checkbox[]" value="1"><i class="helper"></i> 1 </label></div><br /><br />
<div class="checkbox"><label><input type="checkbox" name="checkbox[]" value="2"><i class="helper"></i> 2 </label></div><br /><br />
<div class="checkbox"><label><input type="checkbox" name="checkbox[]" value="3"><i class="helper"></i> 3 </label></div><br /><br />
<div class="checkbox"><label><input type="checkbox" name="checkbox[]" value="4"><i class="helper"></i> 4 </label></div><br /><br />
</div>
</td>
</tr>
</tbody>
</table>
</form>
&#13;