CSS: how to align center-to-center horizontally the labels and the fields?
I have this page.
How do I horizontally align center-to-center the labels an开发者_运维知识库d the fields?
Regards
Javi
The easiest way is to simply add padding-top
to the labels.
There's no inherent way in CSS of expressing the relative alignment of two elements, but just establishing good margins and padding is almost always sufficient.
The only real way to do it is with JavaScript.
http://www.nealgrosskopf.com/tech/thread.php?pid=37
Try this:
#contenedor_formularios label{
padding-top:4px;
}
line-height is the best option when you need to vertical-align text (non-wrapping text, that is).
So, i tested it on firebug and adding line-height:20px to the label element seems to do the trick.
Actually the best way to wrap the label in a span or div like the following:
<span style="display: inline; padding-top:4px; margin-right: 10px; float: left;">
<label for="email">Email Address</label>
</span>
精彩评论