In a form with limited width, while longer label text may wrap onto multiple lines, only the first line is often indented due to the associated input element. This can result in an unorganized appearance.
To address this issue and indent all lines consistently, you can employ CSS:
.checkbox-field {</p> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false">display: flex; flex-direction: row;
}
<div class="checkbox-field"></p> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"><input type="checkbox" id="check"> <label for="check">Field 2 Label, may be longer than normal, This is an example for this lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem</label>
The CSS code:
The HTML code:
With these adjustments, the label text will wrap and indent consistently, resulting in a visually organized form.
The above is the detailed content of How to Indent Multiple-Line Label Text on Forms with Limited Width?. For more information, please follow other related articles on the PHP Chinese website!