Writing HTML Element Attributes

Q

How To Write Element Attributes Properly?

✍: FYIcenter.com

A

If an attribute is allowed for an XHTML element, you must write the attribute inside the opening tag of this element. Here are some rules on writing element attributes:

  • An attribute must have a name and a value, separated by the equal sign "=".
  • An attribute name must be written in lower case letter.
  • An attribute value must be enclosed in a pair of quotes.
  • Multiple attributes can be written in any order.
  • Some attributes must use predefined values.

Here are some good examples of element attributes:

  • <td colspan="2"> - One attributes: "colspan".
  • <input type="text" name="Phone"> - Two attributes: "type" and "name".
  • <link rel="stylesheet" type="text/css" href="_local.css"/> - Three attributes: "rel", "type" and "href".

 

HTML Tag and Attribute Syntax

⇒⇒HTML Tutorials

2017-02-20, 200👍, 0💬