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

HTML Interview Questions and Answers For Freshers

Uploaded by

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

HTML Interview Questions and Answers For Freshers

Uploaded by

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

HTML Interview Questions and Answers for Freshers

1. Difference between Inline and Block Element


1. Inline Element: Inline elements are those HTML elements that are displayed within a
line of text. These tags do not start with a new line. And width of Inline elements only
extends as far as it is defined by its tags.

2. Block Element: Block elements are those that create a new line and take up the full
width of their container. Block elements starts from a new line on a webpage and
extends the full width of the available horizontal space of its parent element.

2. Do all HTML Tags have an end tag?


No, all the HTML tags don’t have end tag. And the HTML tags who don’t have end tag
are called empty tags.

For example: <br> tag is used to break the line. And it doesn’t have an end tag.

3. How to create a hyperlink in HTML?


In HTML we can create hyperlinks with the help of anchor tag. It contains
a href attribute which define the URL or hypertext. And <a> and </a> tags are used to
create hyperlink.

4. How many types of heading does an HTML contain?


HTML contains six levels of headings, and these heading elements are h1, h2, h3, h4,
and h6. In these h1 is the highest or the most important level, and the h6 element is the
least important. And h6 is the smallest heading.

5. What is the difference between HTML elements and tags.


An HTML element is the collection of a start tag, its attributes, and end tag or
everything in between.

While HTML Tag (either opening and closing) is used to mark the start or end of an
element.

All rights reserved – designwithrehana.com


All HTML elements don’t require the end tag or closing tag. And the HTML tags which
don’t need closing tag are referred as empty elements, self-closing elements or void
elements.

6. What are the basic structure and tags of an HTML document?


An HTML document has a basic structure that includes an opening and closing HTML
tag, a head tag with a title, and a body tag that contains the content of the webpage.

Some commonly used HTML tags are h1-h6 for headings, p for paragraph, a for
links, img for images, and div for dividing sections of the page.

7. What is the difference between div and span tags?


The HTML div tag is used for division. It is used to divide a page into sections, while the
span tag is used to apply styles to small pieces of text within a larger block of content.

Where div is a block-level HTML element and span is a inline-level HTML element.

8. What is semantic HTML?


Semantic HTML is the use of specific HTML tags to indicate the meaning of the content
on a page, rather than just using generic tags like div and span. Semantic HTML also
helps to improve accessibility and SEO of website.

9. What is the role of the alt attribute in an image tag?


The alt attribute in img tag provides the alternative text that is displayed when the
image not loaded or if the user is using a screen reader to access the content.

10. What is the purpose of the <meta> tag?


The meta tag provides metadata about the HTML document. Meta tag contains the
information of webpage like the page title, description, and keywords for SEO (Search
Engine Optimization).

11. What is the difference between HTML and XHTML?


XHTML is a stricter version of HTML which requires well-formed code and it follows XML
rules, while HTML is more forgiving and allows for more flexibility in coding.

All rights reserved – designwithrehana.com


12. What is the difference between an ID and a class in HTML?
An ID is a unique identifier for an HTML element, and a HTML element can contains only
one ID, while a class is a way of grouping multiple elements together for styling
purposes. And a HTML element can contain more than one class and more than one
HTML elements can contain the same class.

13. What is the box model in HTML and CSS?


The box model is a way of representing an HTML element as a rectangular box
with content, padding, borders, and margins. Box model is very important for
understanding the layout and styling in HTML and CSS.

14. What are the some best practices for HTML coding?
Best practices for HTML coding are using semantic tags, optimizing images for fast
loading speed, minimizing code bloat, and testing code in different browsers and
devices.

15. What is marquee in HTML?


An HTML marquee tag is used to add the scrolling behavior on a piece of text. Using
marquee, we can scroll a piece of text horizontally or vertically on our webpage. And
this behavior of horizontally and vertically is depends on the settings.

16. How do you create nested web pages in HTML?


In HTML we can create nested web pages with the help of HTML iframe.

17. What is an image map?


An image map is an image that has clickable locations. We can easily navigate to
another page by clicking on a specific section on the image. And the various areas
are identified by one or more area tags.

All rights reserved – designwithrehana.com

You might also like