表单标签的CSS样式 [英] CSS styling of form tags

查看:98
本文介绍了表单标签的CSS样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,< / form> 标签应作为网页的一部分不可见,并且在设计

As far as I am aware, a <form></form> tag is supposed to be invisible as part of a webpage, and that when designing a form, one should use div tags (or equivalent) to represent the physical form structure.

将CSS应用于<$ c是可以接受的(根据W3C标准) $ c>< form>< / form> 标签?

Is it acceptable (according to W3C standards) to apply CSS to a <form></form> tag? and can anyone point me in the right direction for literature on this issue?

推荐答案


我知道,< form /< / form> 标签应该作为网页的一部分不可见

As far as I am aware, a <form></form> tag is supposed to be invisible as part of a webpage

应该代表一种形式。


这绝对是可见的,并且在设计表单时,应该使用div标签(或等效标签)来表示物理表单结构。

and that when designing a form, one should use div tags (or equivalent) to represent the physical form structure.

< div> 是最后的选择。当不存在更合适的内容(例如< form> < fieldset> )时使用它。

<div> is the tag of last resort. Use it when something more suitable (like <form> or <fieldset>) does not exist.


是否可以接受CSS(根据W3C标准)将CSS应用于< form>< / form> 标签?

排除浏览器中的错误,可以对文档中的任何元素进行样式设置。

Baring bugs in browsers, it is acceptable to style any element in the document.


有人能指出我关于这个问题的正确文献吗?

and can anyone point me in the right direction for literature on this issue?

该元素没有什么特别的,它不需要特定的文档。

Since there is nothing special about the element, it does not need specific documentation.

我能想到的最接近的是来自CSS 2.1规范的此警告

The closest I can think of is this warning from the CSS 2.1 specification:


注意。 CSS为 class属性提供了如此强大的功能,以至于作者可以想象基于几乎没有关联表示的元素(例如HTML中的DIV和SPAN)设计自己的文档语言,并通过 class属性分配样式信息。作者应避免这种做法,因为文档语言的结构元素通常具有公认的含义,而作者定义的类可能没有。

Note. CSS gives so much power to the "class" attribute, that authors could conceivably design their own "document language" based on elements with almost no associated presentation (such as DIV and SPAN in HTML) and assigning style information through the "class" attribute. Authors should avoid this practice since the structural elements of a document language often have recognized and accepted meanings and author-defined classes may not.

…但是与这个问题相关的是一个延伸,因为您建议使用语义标记,但是纯粹是为了样式添加不必要的div。

… but relating that to the question is a stretch since you are suggesting using semantic markup, but adding unnecessary divs purely for styling.

这篇关于表单标签的CSS样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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