Check Lesson 4 – HTML Elements from Learn HTML section on e akhabaar
What are HTML elements?
HTML elements are represented by a starting tag and a closing tag with content in between them.
For example –
What are nested HTML Elements:
When one HTML element is put inside another HTML element, it is called nested HTML elements. Nested HTML elements are widely used these days, while making a web page. Example is shown below:
This is italic heading
This is underlined paragraph
Result will be displayed as:
This is italic heading
This is underlined paragraph
What are empty HTML element?
When there is no content in between HTML tags it is called Empty HTML element. E.g. <br /> is an empty element, where it is opened and closed without any content in between the tags. Please remember there is a space after br character followed by forward slash (/).
Interview Question:
- Give some examples of empty html elements?
Here are some examples of empty html elements:-
Tag | Description | Syntax |
To break a line |
some text |
|
To link other page | ||
|
To give a space between a paragraph |
some text
other text |
To insert an image. where src = source file, alt = alternative text, width, and height act as attributes |
Practice Exercise:
This is a paragraph.
- Find all Nested and Empty html elements and try to use them in above html code.
Post your comments about Lesson 4 – HTML Elements below.