简体   繁体   English

我如何使自由联系表格上的标签宽度更宽?

[英]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:我从freecontactform.com获得了一个网站表格,我如何制作它,以便他们的全名有更多空间:以及我编辑过的所有其余字段并制作了我自己的自定义字段,但它进入了下一行太长时,它看起来像这样:

(more text) Full N ame: (更多文字)全名:

the code is here for the html代码在这里用于 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:或者简单地在文本中放置一个不间断空格 ( &nbsp; ):

<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.这本质上就是 nowrap 所做的,就是将所有空格转换为不间断的。

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. nowrap空格序列将折叠成单个空格。 Text will never wrap to the next line.文本永远不会换行到下一行。 The text continues on the same line until a <br> tag is encountered文本继续在同一行,直到遇到<br>标记

https://www.w3schools.com/cssref/pr_text_white-space.asp 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;就我个人而言,我会走 CSS 路线,它比&nbsp;更简洁、更易于阅读&nbsp; all over the place.到处都是。

Enjoy.享受。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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