


How to make the checkbox in td left aligned? ? _html/css_WEB-ITnose
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.
Reply to discussion (solution)
If checkbox and text are required If you don’t want to wrap the line, change the div to span and br between spans.
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>
Method 2:
<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?

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

This article explains the HTML5 <time> element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit

The article discusses the <iframe> tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.
