在 HTML 中创建表单时正确使用标签?
英语不是我的母语,所以当我看到像...
form、input、textarea、这样 的标签时,我有点困惑>select、fieldset、label等。
您能否启发我并告诉我何时、为什么以及如何使用这些标签来制作 HTML 表单。这甚至更像是一个 SEO 问题......你知道,你可以这样写:
<form ...>
<p><input type="text" /></p>
<p><input type="password" /></p>
<p><button>I Won't Bite!</button></p>
</form>
但是 Google 不会高兴,我 100% 确定它也不会正确。是的,它会起作用,因为你可以使用 CSS 来设置标签的样式,使其表现得像任何东西,但它仍然不正确......请启发我,好心人!
English isn't my native language so I'm little confused when I see tags like...
form, input, textarea, select, fieldset, label etc..
Can you enlighten me and tell me when, why and how to use these tags to make HTML form. It's more like a SEO question even... You know, you could write like:
<form ...>
<p><input type="text" /></p>
<p><input type="password" /></p>
<p><button>I Won't Bite!</button></p>
</form>
But Google won't be happy and I'm 100% sure that it won't be correct neither. Yes, it would work, because you can style your tags to act like anything with CSS, but it still isn't correct... Enlighten me, good people!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我认为您正在寻找的参考是
上的 HTML 规范
如果您不确定标记在语义上是否有效,可以使用 W3C Makrup 验证器进行检查,但通常不值得让您的标记 100% 有效 - 更重要的是创建一个在不同浏览器中外观和工作都相当一致的页面。
至于 SEO,已经有很多大量相关问题,例如 < a href="https://stackoverflow.com/questions/638625/what-is-the-best-way-to-struct-an-html-document-for-seo-and-accessibility">什么是最好的方法构建 HTML 文档以实现 SEO 和可访问性?
I think the reference you're looking for is the HTML spec on the
<form>
element.If you're not sure if your markup is semantically valid, you can check it using the W3C Makrup Validator, but it's generally not worth making your markup 100% valid — much more important to create a page that looks and works reasonably consistently across browsers.
As for SEO, there is a ton of relevant questions on SO already, such as What is the best way to structure an HTML document for SEO and accessibility?
HTML 表单是可用于各种功能的代码片段。最常见的用途是使用
GET
方法或POST
方法将数据发送到另一个页面。表单操作值 W 将替换为处理脚本的 URL。
表单方法值 X 将替换为 GET 或 POST。
用于获取用户输入的文本字段。
密码字段本身仅隐藏用户屏幕上的文本
浏览器和服务器之间的安全链接是另一回事
这会将文本放在一行上,直到按下 Enter 键
select 元素内的
标记定义列表中的可用选项。
标签定义输入元素的标签。
HTML forms are pieces of codes that can be used in various functions. The most common use for is to send data to another page using
GET
method orPOST
method.The form action value W would be replaced with the URL of the processing script.
The form method value X would be replaced with GET or POST.
The text field to get input from user.
The password field by itself only hides the text on the users screen
A secure link between the browser and server is a seperate matter
This puts text on a single line until the enter key is pressed
The
<select>
tag is used to create a select list (drop-down list).The
<option>
tags inside the select element define the available options in the list.The
<fieldset>
tag is used to logically group together elements in a form.The
<fieldset>
tag draws a box around the related form elements.The
<label>
tag defines a label for an input element.SEO是对内容进行优化,以便搜索引擎能够找到内容中的重要关键词。表单优化没有真正的价值,因为这只是为用户定义输入字段的标记。表单用于将数据发布到服务器。我认为许多搜索引擎甚至会跳过表单。
SEO is for optimization of content so that search engines can find important keywords in the content. There is no real value in optimization of forms because that is just a markup to define input fields for user. Form is for posting data to the server. I think that many search engines even skip forms.
我知道这是一个非常古老的问题。
您可以使用星号“*”和空格,这将为您提供要点
示例,
下面将是结果。
I kow this is very old question.
You can use asterisk '*' and space this will give you bullet point
example
below will be the result.