I have a form with limited width, however the label text maybe longer than form width, so the text was wrapped to multiple lines. My problem is that first line is indented because of input element but second line is not, it makes the form not nice.
Do you have any idea to make the second, third ... will be indented as first line, only use CSS?
Actual:
My Expectation is
This is my example for the case:
http://jsbin.com/UvaqISO/2/edit
Method 2: By making the position relative to the first line, set the text-indent to -26px and padding-left value to 26px. Here in this example, we have made the position of the second line relative to the first line. So the second line is indented/aligned according to the first line.
It sounds like you have "hanging indents." Under the View tab, turn on display of Rulers. Click in one of the paragraphs and then right-click and choose Paragraph. You should be able to see the indent settings that are reflected on the horizontal ruler.
Edit your css
like this:
.form {
width: 300px;
}
label {
display: block;
margin-top: -20px;
margin-left: 20px;
}
Something like this.
.checkbox-field {
display: flex;
flex-direction: row;
}
<div class="checkbox-field">
<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>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With