Hướng dẫn html attribute list

HTML attributes provide additional information about HTML elements.

HTML Attributes

  • All HTML elements can have attributes
  • Attributes provide additional information about elements
  • Attributes are always specified in the start tag
  • Attributes usually come in name/value pairs like: name="value"

The href Attribute

The Visit our HTML tutorial

Bad:

Visit our HTML tutorial

Sometimes you have to use quotes. This example will not display the title attribute correctly, because it contains a space:

 At W3Schools we always use quotes around attribute values.

Single or Double Quotes?

Double quotes around attribute values are the most common in HTML, but single quotes can also be used.

In some situations, when the attribute value itself contains double quotes, it is necessary to use single quotes:

Or vice versa:

Chapter Summary

HTML Exercises

Test Yourself With Exercises

Exercise:

Add a "tooltip" to the paragraph below with the text "About W3Schools".

W3Schools is a web developer's site.

Start the Exercise

HTML Attribute Reference

A complete list of all attributes for each HTML element, is listed in our: HTML Attribute Reference.



Chủ Đề