Reviewing HTML
HTML deals with the content of a web page.
HTML deals with the content of a web page.
ALL HTML5 documents consist of a
<!DOCTYPE html>and an<html>element only. There should be nothing else in the file!
| |
The
<html>element should contains only a<head>element and a<body>element. Nothing else is allowed as a direct child of the<html>element.
| |
Within the
<head>element there should be a<title>element and<meta>element defining the character set. You can also add other information about the document, including linked files and scripts. All the visible content of the page should be inside the<body>element.
| |
HTML elements consist of content between matching pairs of tags.

The opening and closing tags are slightly different
Elements can have attributes to add information that should not be considered content. Attributes are key/value pairs separated by an equals symbol.
| |
Attributes are placed inside the opening tag.Attribute values should be contained in “double quotes”. Pay attention to the details.
| |
Some common mistakes include missing the space between attributes and missing quotes around attribute values.
Void elements such as
<br>,<img>and<input>are not allowed to contain content. These elements do not require closing tags.
| |
The
<input>element has a value attribute rather than content.
| |
The
<link>and<meta>elements are also void
Semantic elements add meaning to your document structure and provide accessibility advantages. Choosing semantic elements in preference to meaningless elements such as
<div>and<span>adds meaning.
| |
| |
Semantic documents can be understood more fully by the browser and by other software because the various elements have been given meaning.
Accessible Rich Internet Applications (ARIA) present information to assistive technologies to improve accessibility. Adding a
rolewill convert your element into an ARIA landmark.
| |
| |
Most of the newer, semantic elements include these roles implicitly. This makes your HTML simpler and more accessible. See the Chrome A11y podcast for more on accessibility.
Anchor elements require a hypertext reference (an href attribute) pointing to the link destination as a Uniform Resource Locator (URL).
There are three main kinds of link.
linking to another element
| |
linking to another document
| |
linking to another server
| |
Combinations are common.
| |
The content will become a clickable link.
Clicking the link with induce the browser to issue an HTTP GET request and render the document provided by the server.
In a normal scenario, we load a page using a
GETrequest, e.g. with a hyperlink.
| |
It is also possible to load a page by submitting a form. Forms issue
GETrequests by default, but can have theirmethodattribute set toPOST.
| |
Anchors and forms are examples of hypermedia controls.
Submitting forms passes data to the server only for elements with a name attribute.
| |
GETrequests will include data assearch parameterswithin the URL and are useful for adding detail to a request, e.g. filtering or sorting results.
POSTrequests include data in the requestbodyand (when served over HTTPS) can be used for sensitive data.
The web application server needs to understand what is being requested by interpreting the URL the method and the data.
If you have any questions, now is a good time to ask.
Thanks for listening