如何从表格切换到格式FORM布局? [英] How to switch from table to div for FORM layout?

查看:132
本文介绍了如何从表格切换到格式FORM布局?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到大多数人都在谈论使用DIV和CSS
标签,文本框对。如何转换表格,例如:

I'm noticing most folks are talking about using DIVs and CSS for label, textbox pairs. How would one convert a table such as:

<table>
   <tr>
      <td><some Label1> </td>
      <td><some TextBox1> </td>
   </tr>
   <tr>
      <td><some Label2> </td>
      <td><some TextBox2> </td>
   </tr>
   ...
</table>

从使用表到CSS,一个示例将是有帮助的!目前我正在使用一个表来做这样的事情,想象一个只显示一些用户信息的网站。我如何使用DIV而不是表格式显示对(标签,文本框)?

From using a table into say a div with CSS, a sample would be helpful! Currently I was using a table for such a thing, imagine say a site that just displays some user information. How would I display the pairs (the label, the text box) using DIVs rather than table format?

假设标签/文本框是ASP.net标签和文本框。 / p>

Assume the labels / textbox's are ASP.net labels and textboxes.

推荐答案

请参考Woork的这篇文章,题为清洁和纯CSS表单设计

Consider this article at Woork titled Clean and Pure CSS Form Design

样式,包括 fieldset ,并根据所需的外观/感觉调整所有样式。

I've implemented this style, including the fieldset and tweaked all the styles appropriately for the look/feel that was required.

< label runat =server> 通过CSS继承标签的样式,而不是 asp:label 。或者,您可以将 asp:label 放在标签标签中。由于 asp:label 发出< span> ,这只会导致一组 < label>< span>< / span>< / label>

Consider using <label runat="server"> to inherit the style of the label via CSS instead of asp:label. Alternatively you could put your asp:label within label tags. Since asp:label emits <span>, that would simply result in a set of <label><span></span></label>.

这篇关于如何从表格切换到格式FORM布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆