English 中文(简体)
Vertical Align text in a Label
原标题:Vertical Align text in a Label
  • 时间:2009-10-12 14:36:55
  •  标签:

有人要求我以垂直方式将实地标签中的案文统一起来,但我不理解为什么这些文本没有改变。 我尝试使用<代码>垂直-align:top;和其他属性(bottommiddle,但做了t工作。

任何想法?

<dd>
   <label class="<?=$email_confirm_class;?>" 
          style="text-align:right; padding-right:3px">Confirm Email</label>
   <input class="text" type="text" 
          style="border:none;" name="email_confirm" 
          id="email_confirm" size="18" value="<?=$_POST[ email_confirm ];?>" 
          tabindex="4" /> 
   *
</dd>
问题回答

可在2018年+中使用弹性箱:

.label-class {
    display: flex;
    align-items: center;
}

Browser support: https://caniuse.com/#search=flex Box

纵向协调只与inlineinline-block元素有关,它只与其他线性[24]元素有关。 由于你贴上标签,它成为<>24要素。

您案例的最简单解决办法是将标签贴在<代码>上:24小时,并在标签和投入上添加<代码>垂直-align:中。 (你可能认为,案文的高度是,垂直的调子使任何变化都不会改变)。)

您是否尝试过<条码>-八条<>。 如果存在多头标签,它就没有解决你的问题,但它可以成为迅速的解决办法。

www.un.org/Depts/DGACM/index_french.htm 在桌子里使用风格,这样,在座各位就能够赢得任何东西。

为使标签与投入箱一致,请使用<编码>在线-八:

line-height: 25px;

我也存在同样的问题,并解决了将<代码>label打成div,并确定了以下风格:

<div style="display: table; vertical-align: middle">
  <label style="display: table-cell;" ... > ... </label>
</div>

这就是我通常对标签内的“纵向调和”案文做的:

label {
   display: block;
   float: left;
   padding-top: 2px; /*This needs to be modified to fit */
}

它赢得了很高的票价,但运作良好。

我来到这里试图增加一些垂直无线电箱的标签。 我必须这样做:

<%: Html.RadioButton("RadioGroup1", "Yes") %><label style="display:inline-block;padding-top:2px;">Yes</label><br />
<%: Html.RadioButton("RadioGroup1", "No") %><label style="display:inline-block;padding-top:3px;">No</label><br />
<%: Html.RadioButton("RadioGroup1", "Maybe") %><label style="display:inline-block;padding-top:4px;">Maybe</label><br />

这使得他们能够适当展示标签,贴上无线电纽顿的标签,尽管我不得不按照你可以看到的那样,将顶层的dding子加起来。 法典是粗略的,但结果是。

label {
        padding: 10px 0;
        position: relative;
    }

添加一些dding子和dding子,而不是高。

您贴上标签。

例如:

label {line-height:1em; margin:2px 5px 3px 5px; padding:2px 5px 3px 5px;}

通知说,班轮将调整线路的高度,而边值将决定距离其他部件在可装和dding子之外的程度,则将决定标签外面的任何内部空间。 休息室和休息工作(24小时:托托托维德左边),因此2px 5px 3px 5px:

2px Top 5px Right 3px Bottom 5px Left

为此,你应改变投入的纵向财产。

<dd><label class="<?=$email_confirm_class;?>" style="text-align:right; padding-right:3px">Confirm Email</label><input class="text" type="text" style="vertical-align: middle; border:none;" name="email_confirm" id="email_confirm" size="18" value="<?=$_POST[ email_confirm ];?>" tabindex="4" /> *</dd>

Here is a more complete version. It has been tested in IE 8 and it works. see the difference by removing the vertical-align: middle from the input:

<html><head></head><body><dl><dt>test</dt><dd><label class="test" style="text-align:right; padding-right:3px">Confirm Email</label><input class="text" type="text" style="vertical-align: middle; font-size: 22px" name="email_confirm" id="email_confirm" size="28" value="test" tabindex="4" /> *</dd></dl></body></html>

在标签上添加<条码>:flex 财产将完成!

None of these worked for me. I am using ASP.Net MVC with Bootstrap. I used the following successfully:

.label-middle { 
    padding-top:6px;
}

<label id="lblX" class="label-middle" ></label>

这把标签与后面的文本箱纵向统一。

如果你贴上标签,那么婚礼可能会扩大。 为避免这种情况,您可使用差额:

div label {
    display: block;
    text-align: left;
    margin-bottom: -0.2%;
}

不要再添加任何dding子或ed子!

相反,仅仅确保当你拥有像这样的超文本时:

<label><input type="checkbox" name=""><span>Checkbox Text</span></label>

有理由确保投入高度和宽度相同,案文的字体大小相同。

然后,它会完全看重,看重。

阁下:

<label class="styling_target">Label Text</label>
<input />

而是:

<label>
  <span class="styling_target">Label Text</span>
  <input />
</label>

贴上标签确实不可行,但你内部可以随意使用超文本,你可以这样作。

A. 部队相对职位提供上下/下级调整

.whatever {
    position: relative;
}

.whatever .input {
    position: relative;
}

.whatever span {
    position: relative;
    top: -2px; /* adjust this up or down */
}
<label class="whatever">
    <input type="checkbox"><span>my thing</span>
</label>

Just set the vertical-align property of thebell to top.

label {
  vertical-align: top;
}
 <label for="desc">Description</label>
 <textarea name="desc" id="desc" cols="30" rows="10"></textarea>

缺乏权威性,纯粹是html,没有中央支助事务解决办法:

<table>
   <tr>
      <td>
         <label></label>
      </td>
   </tr>
   <tr>
      <td>
         <input></input>
      </td>
   </tr>
</table>




相关问题
热门标签