本文介绍了在&LT文件; FIELDSET> <标签>标签,而不是使用表的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚碰到这些MVC中,并想用表格的他们,而不是有时,为表和DIV的只是不拌匀!

I've just come across these in MVC, and would like to use them instead of tables sometimes, as tables and DIV's just don't mix well!

从未见过这些前,并想知道是否有对这些新表替换标记任何文件?我还听说利用这些相对于表的建议,因此希望自己熟悉他们正确地(而不是猜测它们是如何工作的,因为我最近一直)。

Never seen these before, and was wondering if there is any documentation about these new table-substitute TAGs? I've also heard recommendations to use these as opposed to tables and would therefore like to familiarize myself with them properly (as opposed guessing how they work as I have been recently).

感谢

PS:这些东西并没有在HTML中存在时,我学的是HTML,我记得我4.0岁前,当它出来学习HTML ...

ps: these things did not exist in HTML when i studied HTML, and i recall i studied HTML 4.0 ages ago, when it came out...

推荐答案

使用字段集包含表单元素的一个相当标准的方法就是把它作为一个基本组成部分,就像一个div。把它看成是一个包含分区具有语义值,并且可以使用图例元素在相当基本的XHTML这样的:

A fairly standard way of using fieldsets to contain form elements is just to use it as a basic building block, like a div. Think of it as a containing div that has semantic value and that you can use the legend element in. Fairly basic XHTML for this:

<fieldset>
  <div>
    <label for="x">Thing</label>
    <input type="text" id="x" name="x" />
  </div>
  <div>
    <label for="y">Thing</label>
    <input type="text" id="y" name="y" />
  </div>
</fieldset>

(股利是必要的IE6和方便尽管如此pretty的。)然后,在你的CSS格式的字段集,并相应地等。例如,你通常会想晚饭preSS正常的边界一个字段给出。

(The div is pretty necessary for IE6 and handy nonetheless.) Then in CSS you format the fieldset and such accordingly. For instance, you'll usually want to suppress the normal border a fieldset is given.

fieldset { border: 0; }
fieldset.display { border: 1px solid #cccccc; }
/* You can always invert this. Up to you. */

有很多的,你需要做其他的事情,但是这将让你开始 - 这是pretty的简单,只是把它当作一个语义块元素,像一个div,但与意义,从这里开始。集团的元素为逻辑组,如果你以往任何时候都需要从表格的其余部分区别开来,所有你需要做的是改变字段集的类并添加的。

There's a lot of other things you'll need to do, but that'll get you started--it's pretty much just treating it as a semantic block element, like a div but with meaning, from here. Group your elements into logical groups, and if you ever need to differentiate it from the rest of the form, all you have to do is change the fieldset's class and add a legend.

这篇关于在&LT文件; FIELDSET&GT; &LT;标签&gt;标签,而不是使用表的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-27 11:19