HTML Concepts
Table of Contents
- HTML Template
- HTML Attributes vs DOM Properties
- Quotes for HTML attribute values
- HTML Boolean Attribute
HTML Template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TITLE</title>
</head>
<body>
<h1>HEADING</h1>
<p>CONTENT</p>
</body>
</html>
HTML Attributes vs DOM Properties discussion
- There are three attributes:
id
,type
andvalue
. - Once the browser parses this code, a
HTMLInputElement
javascript object will be created. - There are some properties in this object like
accept
,align
,attributes
etc. - The attributes defined in HTML go into the object's
attributes
property. DOM nodes like
HTMLInputElement
will have the attributes corresponding properties.
Quotes for HTML attribute values discussion
- Quotes are optional, but it's recommended to consistently use double quotes.
- In other words, quoting doesn't mean that the type of value is string or something.
HTML Boolean Attribute discussion
- The presence of a boolean attribute on an element represents the
true
value - The values "true" and "false" are not allowed on boolean attributes.