W开发者_JAVA百科hy do we use labels in rails? such as in a form_for,
f.label
f.text_field
When you don't use labels, everything still works. So why use them?
This method generates <label>
elements in the output HTML which are used to semantically mark up the form: that is, it assigns semantic meanings to the labels in the form as opposed to the input controls themselves. This is useful for nonvisual browsers such as screen readers etc. which need to make a distinction between different parts of a web page based on their meanings and thus can improve accessibility of web pages to users with visual impairments.
精彩评论