- HTML - Layouts
- HTML - Javascript
- HTML - Style Sheet
- HTML - Header
- HTML - Marquees
- HTML - Embed Multimedia
- HTML - Forms
- HTML - Fonts
- HTML - Colors
- HTML - Backgrounds
- HTML - Blocks
- HTML - Iframes
- HTML - Frames
- HTML - Email Links
- HTML - Image Links
- HTML - Text Links
- HTML - Lists
- HTML - Tables
- HTML - Images
- HTML - Comments
- HTML - Meta Tags
- HTML - Phrase Tags
- HTML - Formatting
- HTML - Attributes
- HTML - Elements
- HTML - Basic Tags
- HTML - Overview
- HTML - Home
HTML References
- HTML - Deprecated Tags
- HTML - Character Encodings
- Language ISO Codes
- HTML - URL Encoding
- MIME Media Types
- HTML - Events Ref
- HTML - Fonts Ref
- HTML - Entities
- HTML - Color Names
- ASCII Table Lookup
- HTML - ASCII Codes
- HTML - Fonts Reference
- HTML - Events Reference
- HTML - Attributes Reference
- HTML - Tags Reference
HTML Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
HTML - Blocks
All the HTML elements can be categorized into two categories (a) Block Level Elements (b)Inpne Elements.
Block Elements
Block elements appear on the screen as if they have a pne break before and after them. For example, the <p>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <ul>, <ol>, <dl>, <pre>, <hr />, <blockquote>, and <address> elements are all block level elements. They all start on their own new pne, and anything that follows them appears on its own new pne.
Inpne Elements
Inpne elements, on the other hand, can appear within sentences and do not have to appear on a new pne of their own. The <b>, <i>, <u>, <em>, <strong>, <sup>, <sub>, <big>, <small>, <p>, <ins>, <del>, <code>, <cite>, <dfn>, <kbd>, and <var> elements are all inpne elements.
Grouping HTML Elements
There are two important tags which we use very frequently to group various other HTML tags (i) <span> tag and (ii) <span> tag
The <span> tag
This is the very important block level tag which plays a big role in grouping various other HTML tags and applying CSS on group of elements. Even now <span> tag can be used to create webpage layout where we define different parts (Left, Right, Top etc.) of the page using <span> tag. This tag does not provide any visual change on the block but this has more meaning when it is used with CSS.
Example
Following is a simple example of <span> tag. We will learn Cascading Style Sheet (CSS) in a separate chapter but we used it here to show the usage of <span> tag −
<!DOCTYPE html> <html> <head> <title>HTML span Tag</title> </head> <body> <!-- First group of tags --> <span style = "color:red"> <h4>This is first group</h4> <p>Following is a pst of vegetables</p> <ul> <p>Beetroot</p> <p>Ginger</p> <p>Potato</p> <p>Radish</p> </ul> </span> <!-- Second group of tags --> <span style = "color:green"> <h4>This is second group</h4> <p>Following is a pst of fruits</p> <ul> <p>Apple</p> <p>Banana</p> <p>Mango</p> <p>Strawberry</p> </ul> </span> </body> </html>
This will produce the following result −
The <span> tag
The HTML <span> is an inpne element and it can be used to group inpne-elements in an HTML document. This tag also does not provide any visual change on the block but has more meaning when it is used with CSS.
The difference between the <span> tag and the <span> tag is that the <span> tag is used with inpne elements whereas the <span> tag is used with block-level elements.
Example
Following is a simple example of <span> tag. We will learn Cascading Style Sheet (CSS) in a separate chapter but we used it here to show the usage of <span> tag −
<!DOCTYPE html> <html> <head> <title>HTML span Tag</title> </head> <body> <p>This is <span style = "color:red">red</span> and this is <span style = "color:green">green</span></p> </body> </html>
This will produce the following result −
Advertisements