CSS 表单代替表格 2011

发布于 2024-10-10 08:31:02 字数 239 浏览 0 评论 0原文

当我遇到诸如需要 3 个彼此相邻的文本框(如电话号码)或文本框旁边的下拉列表之类的障碍时,我放弃了使用 CSS 进行表单样式设置。如果没有好的表格,我就无法想出一种可靠的方式来设计它。

我正在考虑重新使用 CSS 来设置表单样式;我不知道:

  1. 将标题放在字段顶部还是左侧更有用。
  2. 如何设计事物的样式,以便即使有几个相邻的表单元素也能很好地放置。

参考?这仍然是一个白日梦吗?

I gave up on using CSS for form styling when I hit snags like requiring 3 textboxes adjacent to one another (like a phone number) or a dropdown list next to a textbox. I just couldn't come up with a reliable way to style it without good ol' TABLES.

I'm thinking about going back to CSS for form styling; I don't know:

  1. Whether it's more usable to have captions on top or on the left of the field.
  2. How to style the things so they place nicely even with a couple of adjacent form elements.

References? Is this still a pipe dream?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

泪是无色的血 2024-10-17 08:31:02

你的意思是这样吗?

alt text

基本上我们创建一个伪表

.mxrow {
clear: both;
width: 100%;
height: 50px;
}


.mxcell {
float: left;
padding-top: 10px;
padding-bottom: 10px;
height: 26px;
}

.mxcell_firstcell{
width: 25%;
}

并且标记将是

<div class = "mxrow">
  <div class = "mxcell mxcell_firstcell"><input element /></div>
  <div class = "mxcell mxcell_secondcell"><another form element/></div>
</div>

各个单元格类名用于应用特定的CSS(我的标记是网格)

You mean like this?

alt text

Basically we create a pseudotable

.mxrow {
clear: both;
width: 100%;
height: 50px;
}


.mxcell {
float: left;
padding-top: 10px;
padding-bottom: 10px;
height: 26px;
}

.mxcell_firstcell{
width: 25%;
}

And the markup would be

<div class = "mxrow">
  <div class = "mxcell mxcell_firstcell"><input element /></div>
  <div class = "mxcell mxcell_secondcell"><another form element/></div>
</div>

The individual cell classnames serve to apply specific css (my markup is a grid)

稍尽春風 2024-10-17 08:31:02

有几个专门为布局表单而设计的 CSS 模板。

我希望这可以帮助您指明一个富有成效且令人敬畏的方向。小心。

There are a couple of CSS templates designed specifically for laying out forms.

I hope this helps point you in a productive and awesome direction. Take care.

静水深流 2024-10-17 08:31:02

不,这是很有可能的,而且我(和许多其他人)多年来一直这样做。

查看float: (left|right)display: (inline|inline-block)

No, it is very possible, and I (and many others) have been doing it for years.

Look at float: (left|right) and display: (inline|inline-block).

丶情人眼里出诗心の 2024-10-17 08:31:02

其他人给了你一些有效的建议...如果你仍然有问题,你可以尝试像 formee 这样的表单 CSS 框架... http ://www.formee.org/

Other people give you some valid suggestions... if you still have problems you can try a form css framework like formee... http://www.formee.org/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文