简体   繁体   English

标签表单字段对齐CSS

[英]label form fields alignment css

How can I make the labels of the form fields align vertically with the billing address heading? 如何使表单字段的标签与帐单地址标题垂直对齐? http://jsfiddle.net/DA9gK/1/ http://jsfiddle.net/DA9gK/1/

<h4 class="billingAddress">Billing Address</h4>

<div class="control-group">
    <label class="control-label" for="inputEmail">Company Name</label>
    <div class="controls">
        <input type="text" id="inputEmail">
    </div>
 </div>

Add

.form-horizontal .control-label {
     text-align: left;
  }

to your CSS part...Is this what you want? 到您的CSS部分...这是您想要的吗?

Take a look at the css box model and if you can implement that, your spacing issues should go away. 看一下css box模型 ,如果可以实现,则间距问题应该消失了。 Floats are some else to consider, but... what you would benefit from specifically here... I can't find the link to, so do this: 浮点数是其他要考虑的问题,但是...您将从此处特别受益...我找不到指向的链接,因此请执行以下操作:

<div id="head"></div>
<div id="nav"></div>
<div id="wrapper"></div>
<div id="leftcolumn"></div>
<div id="rightcolumn"></div>
<div id="footer"></div>

you can share a line between head & nav based on your style, your left form objects go into leftcolumn, right into right, footer holds its own line typically. 您可以根据自己的风格在head和nav之间共享一条线,您的左侧表单对象进入leftcolumn,从右侧进入右侧,页脚通常保持其自己的线。 This relies on absolute positioning of the wrapper and relative positioning of the everything else I believe. 这取决于包装的绝对位置以及我相信的所有其他内容的相对位置。 Floats work too, but are considered less flexible. 浮动元素也可以使用,但灵活性较差。

This approach should give you the kind of control over the spacing you need to make your page "fiddler" example look good. 这种方法应该使您能够控制使页面“提琴手”示例看起来不错的间距。

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

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