0% found this document useful (0 votes)
2 views

HTML Interview Questions and Answers

The document provides a series of HTML interview questions and answers covering fundamental concepts such as the difference between HTML tags and elements, the role of attributes, void elements, and the structure of HTML layouts. It also discusses formatting tags, types of Doctypes, and the semantic differences between certain tags. Additionally, it explains the distinctions between cell padding and cell spacing.

Uploaded by

tapasyahate3
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

HTML Interview Questions and Answers

The document provides a series of HTML interview questions and answers covering fundamental concepts such as the difference between HTML tags and elements, the role of attributes, void elements, and the structure of HTML layouts. It also discusses formatting tags, types of Doctypes, and the semantic differences between certain tags. Additionally, it explains the distinctions between cell padding and cell spacing.

Uploaded by

tapasyahate3
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

HTML Interview Questions and Answers

1. Are the HTML tags and elements the same thing?

No. HTML elements are defined by a starting tag, may contain some content and a closing
tag. For example, <h1>Heading 1</h1> is a HTML element but just <h1> is a starting tag
and </h1> is a closing tag.

2. What are tags and attributes in HTML?

Tags are the primary component of the HTML that defines how the content will be
structured/ formatted, whereas Attributes are used along with the HTML tags to define the
characteristics of the element. For example, <p align=” center”>Interview questions</p>, in
this the ‘align’ is the attribute using which we will align the paragraph to show in the center
of the view.

3. What are void elements in HTML?

HTML elements which do not have closing tags or do not need to be closed are Void
elements. For Example <br />, <img />, <hr />, etc.

4. What is the ‘class’ attribute in HTML?

The class attribute is used to specify the class name for an HTML element. Multiple
elements in HTML can have the same class value. Also, it is mainly used to associate the
styles written in the stylesheet with the HTML elements.

5. What is the difference between the ‘id’ attribute and the ‘class’ attribute of HTML
elements?

Multiple elements in HTML can have the same class value, whereas a value of id attribute of
one element cannot be associated with another HTML element.

6. Describe HTML layout structure.

Every web page has different components to display the intended content and a specific UI.
But still, there are few things which are templated and are globally accepted way to
structure the web page, such as:

 <header>: Stores the starting information about the web page.


 <footer>: Represents the last section of the page.
 <nav>: The navigation menu of the HTML page.
 <article>: It is a set of information.
 <section>: It is used inside the article block to define the basic structure of a page.
 <aside>: Sidebar content of the page.

7. What are the various formatting tags in HTML?

HTML has various formatting tags:

 <b> - makes text bold


 <i> - makes text italic
 <em> - makes text italic but with added semantics importance
 <big> - increases the font size of the text by one unit
 <small> - decreases the font size of the text by one unit
 <sub> - makes the text a subscript
 <sup> - makes the text a superscript
 <del> - displays as strike out text
 <strong> - marks the text as important
 <mark> - highlights the text
 <ins> - displays as added text

8. What are the different kinds of Doctypes available?

The three kinds of Doctypes which are available:

 Strict Doctype
 Transitional Doctype
 Frameset Doctype

9. What is the difference between <strong>, <b> tags and <em>, <i> tags?

The effect on a normal webpage of the tags <strong>, <b> and <em>, <i> is the same. <b>
and <i> tags stands for bold and italic. These two tags only apply font styling and bold tag
<b>, just adds more ink to the text, these tags don't say anything about the text.

Whereas, <strong> and <em> tags represent that the span of text is of strong importance or
more importance and emphatic stress respectively than the rest of the text. These tags have
semantic meaning

10. How is Cell Padding different from Cell Spacing?

Cell Spacing is the space or gap between two consecutive cells. Whereas, Cell Padding is the
space or gap between the text/ content of the cell and the edge/ border of the cell. Please
refer to the above figure example to find the difference.

You might also like