Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 81 - logicode 2609 C6
P. 81

    Syntax:

                     <TAG_NAME> content </TAG_NAME>
                     For example:

                                                  <P> My cat is very grumpy </P>

                                               Opening Tag          Content           Closing Tag

                     Most HTML tags have opening and closing tags. The opening tag < > starts an element and the
                     closing tag </ > ends it. Together with the content, they form an element.

                     TYPES OF TAGS

                     HTML5 tags can be classified into two types:
                       Container Tags: Container tags have opening and closing tags that enclose data. The closing

                        tag  has  a  forward slash. Examples  include  <P>…</P>, <HTML>…</HTML>,  <HEAD>…</HEAD>,
                        <BODY>…</BODY> and <H1>…</H1>.
                       Empty Tags: An empty tag is a tag that does not have a closing tag. It is used by itself to add
                        something to a web page. Examples of empty tags include <HR> and <BR>.

                     NESTING TAGS

                     Nesting tags means placing one HTML tag inside another. Tags follow LIFO (Last In First Out):
                     the last opened tag must be closed first.
                     For example:

                     <BODY> <H1> Web Browser </H1> </BODY>

                     ATTRIBUTE
                     An attribute adds extra information to an HTML tag. It has a name and value, is placed in the

                     opening tag and the value is enclosed in quotes.
                     Syntax:

                     <TAG_NAME ATTRIBUTE_NAME="VALUE">...</TAG_NAME>

                               RULES FOR WRITING HTML5 CODE

                     Some of the basic rules for writing HTML5 code are:

                       Content should be placed between opening and closing tags.
                       There should not be any space within the tag. For example, < T A G> is incorrect.

                       All container tags require a closing tag with a forward slash followed by the tag name.

                       Tag names must be enclosed in angle brackets without spaces.

                                                                                                HTML5–Getting Started  79

| 76 77 78 79 80 81 82 83 84 85 86 |