正确对齐控件
我想调整我正在开发的网站上相同控件的外观,但似乎进展不太顺利。 我想使用 CSS 来正确对齐控件。 我想让复选框和标签左对齐,然后留一点空间,然后文本框就来了。 我还希望所有文本框垂直对齐。 我如何在不使用表格的情况下使用 css 来做到这一点。
提前感谢您的帮助,Laziale
I want to adjust the appearance on same controls on the website which I am working on, but it seems that is not going good.
I want to use CSS to properly align the controls.
I want to have the checkbox and the label aligned left and then little bit room, then textbox is coming.
Also I want all the textboxes to be aligned same vertically.
How can I do that with css without using tables.
Thanks in advance for your help, Laziale
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
CSS
HTML
CSS
HTML
说真的,根据您的需要,您应该使用表格。无论如何,你将有更多的 html 和 CSS 尝试实现这一目标。
在 Html 中不使用表格的整个驱动力是为了页面布局,例如您可能希望仅使用 CSS 重新排列页面布局(移动内容)。但我怀疑您是否想要重新排列表单的布局方式。
Seriously, for you need, you should use tables. you'll have a lot more html and CSS trying the achieve this anyway.
The whole drive to not use tables in Html is for layout of pages and such where you may want to rearrange your page layout (move things around) using just CSS. but I doubt you'd want to rearrange the way your form is laid out.
最简单的方法:为输入容器(标签)指定宽度和 float:left http://jsfiddle.net/tCcff /2/
这篇文章是基于 CSS 的表单布局的一个很好的参考:http://articles.sitepoint.com/article/fancy-form-design-css/3
Simplest way: Specify a width and float:left for the input containers (labels) http://jsfiddle.net/tCcff/2/
This article is a good reference for CSS based form layout: http://articles.sitepoint.com/article/fancy-form-design-css/3