For a td, the width is fixed, for example 230px, and the height can be retracted, it doesn’t matter.
There are N checkbox boxes to be displayed in this td, and the length of the characters displayed after the checkbox is also uncertain.
For example, some have 4 Chinese characters, some have 2 Chinese characters, etc.
What should I do to ensure that the checkboxes are all left-aligned?
only needs to be displayed left-aligned in IE6.
I have implemented it, 2 methods, I will share with you.
Method 1:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head> <title>Untitled</title> <style> label{ white-space:nowrap; } </style></head><body><table border=1> <tr> <td width="350px" style="layout-grid-type: strict;"> <label for='a1'><input id='a1' type="checkbox">さふぁ</label> <label><input type="checkbox">あsasあs化fdふぁ</label> <label><input type="checkbox">ふぁあdふぁsdふぁsふぁ</label> <label><input type="checkbox">あえr</label> <label><input type="checkbox">123123123123123123123123123123123123123123</label> <label><input type="checkbox">あdfさsdふぁ</label> <label><input type="checkbox">あsdふぁ</label> <label><input type="checkbox">ふぁふぁ</label> <label><input type="checkbox">あえあsdふぁsdfr</label> <label><input type="checkbox">aaaa</label> <label><input type="checkbox">さふぁ</label> <label><input type="checkbox">あsdふぁ</label> <label><input type="checkbox">ふぁふぁ</label> <label><input type="checkbox">あえr</label> </td> </tr></table></body></html>
<div style="width:200px;border:1px solid;"><span style="display:inline-block"><input type="checkbox" name="chkJobType" id="1" />你好中国中国中国</span><span style="display:inline-block"><input type="checkbox" name="chkJobType" id="2" />你</span><span style="display:inline-block"><input type="checkbox" name="chkJobType" id="2" />你中</span><span style="display:inline-block"><input type="checkbox" name="chkJobType" id="2" />你好中国中国中国中国中</span><span style="display:inline-block"><input type="checkbox" name="chkJobType" id="2" />你好</span></div>
I have implemented this, 2 methods, share with everyone.
Method 1:
XML/HTML code?12345678910111213141516171819202122232425262728293031323334353637
style="text-align:left" Isn’t it possible to set the style?