Page 76 - Plus_V2.2_C6_Flipbook
P. 76

TAGS AND ATTRIBUTES


                  A HTML page is made up of elements each of which is defined by HTML code comprising of tags and
                  attributes. Let us learn more about tags and attributes.
                       Tags

                  It is a way of denoting an HTML element in the program. This is a command that indicates the layout
                  or display of a whole or part of a web page. HTML tags starts with ‘<’ less than sign and ends with ‘>’
                  greater than sign. Most of the elements of HTML have starting tags and ending tags. Ending tags are
                  written using / within angular brackets.

                  For example,
                                                        <B> Hello Students </B>



                                                    Opening Tag          Closing Tag

                  Thus, the pair <B> and </B> constitute one HTML element. Here <B> is known as the starting tag and
                  </B> is known as the ending tag.
                  Output:

                  Hello Students

                  Container tag and Empty tag

                  Such tags which have both starting and ending tags are known as Container tags and tags which do
                  not have ending tags are known as empty tags.
                  For example, <U>…</U> is a container tag whereas <HR> is an empty tag.

                  HTML tags can also be further classified as:
                     Block Level Tags: The block level tags take up the full width available and by default begin on a
                    new line. Some of the block level tags are Paragraph <P>, headings <H1> to <H6>, Horizontal Rule
                    <HR>, etc.
                     Text Level Tags: The text level tags are used to mark up parts of the text. These tags do not start
                    with a new line. Some of the text level tags are Bold <B>, Superscript <SUP>, Italic <I>, Subscript
                    <SUB>, etc.


                  Nesting of tags

                  Nesting of tags means that you can start a new tag before closing the previous tag. The only point to
                  remember is that tags are nested on LIFO principle, that is, Last In First Out. This means that the tag
                  that has been opened last needs to be closed first.

                  For example, <B><I>Hello Students</I></B>
                  Output:






                  74    Premium Edition-VI
   71   72   73   74   75   76   77   78   79   80   81