Structure of HTML
Structure of HTML
You can see the HTML code for this page below. Don't worry about what the code means yet. We start to look at it in more detail on the next page. Note that the HTML code is in red, and the text you see on the screen is in white
The HTML code (in red) is made up of characters that live inside angled brackets — these are called HTML elements. HTML Elements are usually made up of two tags: an opening tag and a closing tag. (The closing tag has an extra forward slash(/) in it.) Each HTML element tells the browser something about the information that sits between its opening and closing tags.
HTML tags act like containers. They tell you something about the information that lies between their opening and closing tags.
- The opening <html> tag indicates that anything between it and a closing </html> tag is HTML code. The closing </html> tag indicates that it is the end of the HTML code.
- The <body> tag indicates that anything between it and the closing </body> tags. The closing </body> tag indicates the end of what should appear in the main browser window.
- Words between <h1> and <h1> are a main heading.
- A paragraph of text appears between these <p> and </p> tags.
- Words between <h2> and <h2> are a sub-heading.
- Here is another paragraph between opening <p> and </p> tags.
HTML Attributes provide additional information about the contents of an element. They appear on the opening tag of the element and are made up of two parts: a name and a value, separated by an equals sign.
The attribute name indicates what kind of extra information you are supplying about the element's content. It should be written in lowercase.In the above Example an attribute called lang is used to indicate the language used in this element. The value of this attribute on this page specifies it is in US English.
The value is the information or setting for the attribute. It should be placed in double quotes ("). Different attributes can have different values.
You met the <body> element in the first example we created. Everything inside this element is shown inside the main browser window.
Before the <body> element you will often see a <head> element. This contains information about the page (rather than information that is shown within the main part of the browser window that is highlighted in blue on the opposite page). You will usually find a <title> element inside the <head> element.
The contents of the <title> element are either shown in the top of the browser, above where you usually type in the URL of the page you want to visit, or on the tab for that page (if your browser uses tabs to allow you to view multiple pages at the same time).
Anything written between the <title> tags will appear in the title bar (or tabs) at the top of the browser window, highlighted in white here.
Leave a comment
No Cmomments yet