简体   繁体   中英

how do i make the width of the label on free contact form wider?

I got a form for a website from freecontactform.com how do I make it so that their is more space by Full Name: and all the rest of the fields as I have edited it and made my own custom fields, but it goes onto the next line when it is too long so it would look like this:

(more text) Full N ame:

the code is here for the html

 <tr> <td valign="top"> <label for="Full_Name" class="required">Full Name<span class="required_star"> * </span></label> </td> <td valign="top"> <input type="text" name="Full_Name" id="Full_Name" maxlength="80" style="width:230px"> </td> </tr>

please note I have spent over an hour trying to google and work out how to do this

Provided no widths are set on the label or the table cell, you could use

/*obviously you can use any selector here that gets the job done*/
label
{
    white-space: nowrap;
}

Or simply put a non-breaking space ( &nbsp; ) in the text:

<label for="Full_Name" class="required">Full&nbsp;Name<span class="required_star">&nbsp;*</span></label>

That is essentially what nowrap does, is converts all the spaces to be non-breaking.

Obviously if the width is restricted for the label or the table cell you may need to adjust those.

For reference:

nowrap Sequences of whitespace will collapse into a single whitespace. Text will never wrap to the next line. The text continues on the same line until a <br> tag is encountered

https://www.w3schools.com/cssref/pr_text_white-space.asp

Personally I would go the CSS route, it's a bit cleaner and easier to read then putting &nbsp; all over the place.

Enjoy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM