Recently Asked Questions and Answers
1. What is meant by an HTML body element?
The HTML
It can contain text content, paragraphs, headings, images, tables, links, videos, etc.
2. What are the HTML elements that are commonly used?
Some of the commonly used HTML elements are:
- h1
- p
- br
- hr
- a
- img
- div
- span
3. What is the use of an HTML anchor element?
We use the HTML
Syntax:
4. What is an HTML heading element and an HTML paragraph element?
Heading Element
HTML defines
- The HTML h1element defines the most important heading of an HTML document.
- The HTML h6element defines the least important heading of an HTML document.
Example:
Paragraph Element
The HTML
Example:
5. What are the differences between HTML div and span elements?
div | span |
---|---|
The HTML div element is a block-level element | The HTML span element is an inline element |
It can be used to wrap around other HTML elements and apply CSS styles to many elements at once | It can be used to wrap a small portion of text, etc and add CSS styles to it |
6. What is an HTML container element?
The HTML container element (
It can be used to wrap a group of elements and apply CSS styles to many elements at once.
7. What are HTML tags?
HTML Tags are like keywords that define how a web browser will format and display the content.
- With the help of tags, a web browser can distinguish between HTML elements and text.
Examples :
8. How many types of HTML heading elements are there?
HTML defines
HTML headings are defined with the
- h1element is the most important heading element.
- h6element is the least important heading element.
9. What is an HTML script element?
The HTML
It can contain scripting statements, or it points to an external script file through the
Example:
10. How many HTML h1 elements can be used on a web page?
Using more than one HTML
11. What is the HTML head element and why we use it?
- The HTML head element is the container for the elements which provide extra information about the document (metadata).
- It describes the properties of the document such as title, character set, style sheets, scripts, etc.
12. How to add line breaks to an HTML paragraph element?
The HTML
It is useful in writing poems, addresses, etc.
Example:
13. How to display images on the web page?
We can display images on the web page using the HTML
Generally, the HTML
- srcspecifies thepathto the image.
- altspecifies analternate textfor the image.
Syntax:
14. What are the attributes we can give to an HTML image element?
The attributes we can give to an HTML image element:
- src
- alt
- height
- width
- class, etc.
15. What is an HTML image element?
Image Element
The HTML
Syntax:
16. Does a hyperlink only apply to text?
No. We can use hyperlinks to text as well as images, buttons, etc.
Example:
17. How to create a link in HTML and what is the HTML target attribute?
The HTML
It requires the HTML
HTML target attribute:
The HTML
It can have the following values:
Value | Description |
---|---|
_self | (Default value) It opens the document in the same window or tab as it was clicked. |
_blank | It opens the document in a new window or tab. |
_parent | It opens the document in a parent frame. |
_top | It opens the document in a full-body window. |
18. What is the difference between HTML anchor element and HTML link element?
HTML anchor element:
We use the HTML
HTML link element:
We use the HTML
19. What is the difference between HTML script element and HTML link element?
HTML script element:
We use the HTML
HTML link element:
We use the HTML
20. What are the differences between the HTML ordered List and the HTML unordered List?
HTML ordered list | HTML unordered list |
---|---|
It is a collection of related items that follow some order or have a sequence | It is a collection of related items that have no special order or sequence |
It is created using the ol element | It is created using the ul element |
By default, list items in the Ordered List are marked with numbers. | By default, list items in the Unordered List are marked with bullets. |
21. Explain types of lists in HTML?
There are three types of lists in HTML:
Unordered list: It is used to group a set of related items in no particular order.
Ordered list: It is used to group a set of related items in a specific order.
Description list: It is used to display name/value pairs such as terms and definitions.
22. Explain the HTML hr (horizontal line) element?
HTML Horizontal Rule Element: The HTML
23. Explain about the HTML block-level elements and inline elements?
Block-level Elements:
The HTML Block-level elements always start in a new line and take up the full width available.
So, an HTML Block-level element occupies the entire horizontal space of its parent element.
Examples: HTML
Inline Elements:
The HTML Inline elements do not start in a new line and take up the content width.
Examples: HTML
24. Why Meta elements are used in HTML?
- Meta elements can contain information about character encoding, description, title of the document etc.
- Meta elements are used to tell the browser about the page description, author of the template, character set, keywords, etc.
- Meta elements are used for search engine optimization to tell the search engine about the page contents.