An HTML document is one that has been divided into its logical parts (i.e. headers, paragraphs, lists, images, quotes and so on) and those parts have been ‘marked up’ with short labels. The labels are called tags. The combination of tags and the text within those tags is called an HTML ‘element’.
Most structural ‘elements’ of an HTML document are enclosed within two tags – an opening tag and a closing tag. It is a good idea to think of elements as containers, e.g. the
tells that browser that this is the start of a paragraph and
tells the browser that this is the end of the paragraph; the text is contained within the start and end tags.
Documents ‘marked up’ correctly will work for people using a variety of different browsers and computers. The logical structure of the document will always be displayed correctly – but the presentation (i.e. the look of the page) can be left to the browser or a style sheet.
HTML documents are divided into two main sections; the head section and the body section. The head section contains meta information; which is information about the document. The most important meta information is the title of the document – as represented by the title element.
The body section contains the content of the document, i.e. the bits that are displayed by the Web browser.
The entire document is enclosed (or contained) within HTML tags; an openingand a closing.
Elements in the body part of the document can be divided into ‘Block’ elements and ‘Inline’ elements.
Block elements – defined distinct blocks of text, typically preceded and followed by a line break – and stretching the full width of the page. Paragraphs, headers, and blockquotes are block elements.
Inline elements are elements that appear within the flow of the text, e.g. strong, a, em, img.
Here is a summary showing the hierarchical nature of HTML documents:
A paragraph of text with an inline element .
Another paragraph of text with an inline element .
Inline elements are nested within block elements, block elements are nested within the BODY element, and the BODY element is nested within the HTML element.
Understanding the hierarchical nature of HTML is important if you want to create accessible Web pages – and is the key to really understanding what HTML documents are and how they work. You need to write valid, standards based HTML documents for Cascading Style Sheets (CSS) to work properly. If you are using style sheets to format your pages, incorrect nesting of elements, or invalid HTML can lead to unexpected results.
Paragraphs:
some text
Headers: some text were n = a number 1 to 6.
Blockquotes:
some text
Links: link text
Images:
Unordered Lists:
- list text
Deprecated elements
Some of the attributes I have mentioned above are now ‘deprecated’ in HTML 4 by the World Wide Web Consortium (W3c). This means that they may be made obsolete in future versions of HTML. Users are discouraged from using them because similar or better results can be obtained by using style sheets.
However they are still legal attributes and can be used alongside style sheets to ensure that a page ‘degrades’ gracefully on browsers that do not support style sheets. A full list of deprecated elements and attributes can be found on the W3c Website.
Contact us today to discuss your website
Or phone to talk over your ideas: 07810 098 119.
Prevous page or post | Next page or post
Let's Chat
07810 098 119