删除< label>之后的换行符 [英] Remove the line break after a <label>

查看:64
本文介绍了删除< label>之后的换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表格由2列表格格式化.在左列中,我使用< label> ,在右列中,使用< input type ="text"> .一些输入框是必需的.因此,要求所有强制性输入的标签旁边应有一个红色星号.但是,标签的设计使其始终带有换行符,因此星号自动位于其下方.确保这种情况不会发生并且星号出现在标签旁边正确位置的最佳方法是什么?我认为< div float ="left> 选项在表中不起作用.这是要求的代码;

My form is formatted by a 2 column table. In the left column I use a <label> and in the right column a <input type="text">. Some of the input boxes are required. So the requirement is that for all the compulsary inputs, there should be a red asterisk next to the label. However a label is designed so that it is always followed by a line break, so the asterisk automatically goes underneath. What is the best way of making sure this does not happen, and the asterisk goes in the correct place next to the label? I do not think the <div float="left> option would work in a table. This is the code as requested;

<tr>
                <td class="leftCell"><span style="white-space: nowrap;"><label for="Subcontractor_CompanyName">Company</label><span style="display: inline;" class="errorHighlight">*</span></span></td>
                <td class="rightCell"><input style="width: 300px;" id="Subcontractor_CompanyName" name="Subcontractor.CompanyName" value="096 club" type="text" data-val-required="Must enter the Company Name" data-val="true">
                    <span class="field-validation-valid" data-valmsg-replace="false" data-valmsg-for="Subcontractor.CompanyName">*</span></td>
            </tr>

我尝试使用< span style ="white-space:nowrap;"> 失败.

推荐答案

或者,如果他们已将< label> 作为块,则可以这样做:

Or, if they have given the <label> as block, you can do this way:

label {display: inline;}

这篇关于删除&lt; label&gt;之后的换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆