CSS 引导形式 - 水平右对齐标签

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12826511/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 20:27:19  来源:igfitidea点击:

bootstrap form-horizontal right align labels

csstwitter-bootstrap

提问by user1735930

If it possible to get right-align labels in twitter bootstrap form-horizontal?

如果可以在 twitter bootstrap form-horizo​​ntal 中获得右对齐标签?

So in this example of horizontal form http://twitter.github.com/bootstrap/base-css.html#formsletter "E" in "Email" will be over letter "P" in "Password".

因此,在卧式成形的这个例子http://twitter.github.com/bootstrap/base-css.html#forms字母“E”,在“电子邮件”将在字母“P”,在“密码”。

回答by Piotr Kempa

Actually, they are right aligned as it is. I think you want to leftalign them (so P is over E) if I understand correctly. If so, you can try this:

实际上,它们按原样正确对齐。如果我理解正确的话,我认为你想对齐它们(所以 P 在 E 上)。如果是这样,你可以试试这个:

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

(it's "text-align: right;" by default in bootstrap.css)

(默认为 bootstrap.css 中的“text-align: right;”)