Property provides additional information for HTML elements.
Properties of HTML Tags
HTML tags have properties. Property provides additional information for HTML elements.
Properties are always in the form of name/value pairs, such as: Name= "value"
Attributes are always specified in the start tag of an HTML element.
attribute Example 1:
<H1 align= "Center" > has additional information about alignment.
Tiy: Centering the headings
<!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><HTML><Body><H1Align= "Center">This is Heading 1</H1><P>The above headings are centered on the page. The above headings are centered on the page. The above headings are centered on the page.</P></Body></HTML>
attribute Example 2:
<body> defines the body of the HTML document.
<body bgcolor= "Yellow" > has additional information about the background color.
Tiy: Background color
<HTML><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=gb2312" /><Metahttp-equiv= "Content-language"content= "ZH-CN" /></Head><Bodybgcolor= "Yellow"><H2>See: Change the color of the background.</H2></Body></HTML>
attribute Example 3:
<table> define HTML tables. (You will learn more about HTML tables in a later section.)
<table border= "1" > has additional information about the table border.
Use lowercase attributes
Property and property values are not case sensitive . However, the World Wide Web Consortium recommends lowercase attribute/attribute values in its HTML 4 recommendation standard, while XHTML requires lowercase attribute/attribute values.
Always quote attribute values
Property values should always be included in quotation marks. Double quotes are the most common, but there is no problem with single quotes.
In some individual cases, such as the attribute value itself contains double quotes, you must use single quotes, for example:
Name= ' John ' shotgun ' Nelson '