Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
7 views

HTML Interview Question and Answers

The document provides a comprehensive overview of HTML, including its purpose, features, and structure. It covers common HTML tags, the differences between HTML and XHTML, and the role of CSS in web design. Additionally, it explains how to create links, tables, forms, and input fields in HTML, along with semantic elements and other related concepts.

Uploaded by

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

HTML Interview Question and Answers

The document provides a comprehensive overview of HTML, including its purpose, features, and structure. It covers common HTML tags, the differences between HTML and XHTML, and the role of CSS in web design. Additionally, it explains how to create links, tables, forms, and input fields in HTML, along with semantic elements and other related concepts.

Uploaded by

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

HTML Interview Question and Answers PDF

1. What is HTML and What is its purpose?

HTML stands for "Hypertext Markup Language", it is a standard


markup language for creating web pages. And the purpose of HTML
is to create the structure of a web page and display the content on
the web, such as text, images, and videos.

2. What are the Features of HTML?

• HTML is a markup language that is used to create web pages


with text easily.
• HTML is easy to use and learn. It enables developers to add text,
images, video, and audio to a web page to make it more
interactive.
• It is platform-independent and can be used on Windows, Linux,
Macintosh, etc.

3. Explain the structure of an HTML document?

An HTML document consists of a DOCTYPE declaration, a head, and


a body. The DOCTYPE declaration specifies the version of HTML
being used, the head contains meta-information about the
document such as the title, and the body contains the main content
of the document.

All rights reserved geekshelp.in 2021-23


4. What are the main components of an HTML document?

The main components of an HTML document are the doctype


declaration, the head, and the body. The doctype declaration
defines the version of HTML document, the head contains meta-
information about the document, such as the title and character
encoding, and the body contains the main content of the document
which will be displayed on the webpage.

5. What are some common HTML tags?

Some common HTML tags are: <html>, <head>, <title>, <body>, <h1>
to <h6>, <p>, <a>, <img>, <ul>, <ol>, <li>, <table>, <tr>, <th>, <td>,
<form>, <input>, <textarea>, <select>, <option>, <button>.

6. What is the purpose of the alt attribute in an HTML image tag?

The alt attribute specifies an alternate text for the image if the
image cannot be displayed then the alt attribute provides
alternative information for an image. It is important for accessibility,
as screen readers can read the alt text to users who are visually
impaired.

7. What is the difference between HTML and XHTML?

HTML stands for "Hypertext Markup Language" and XHTML stands for
"Extensible Hypertext Markup Language". Both HTML and XHTML are
markup languages for creating web pages. XHTML is a more strict
and rigorous version of HTML. XHTML requires all elements to be

All rights reserved geekshelp.in 2021-23


properly nested and closed, and all attributes to be quoted. It also
requires all elements to be in lowercase.

8. What is the purpose of CSS in a web page?

CSS stands for "Cascading Style Sheets". And it is used to control the
layout and presentation of a web page. It is used to apply the styles
on font, color, and spacing of elements. CSS helps to apply the same
design on multiple HTML elements. CSS makes it easier to maintain
and update the look and feel of a website.

9. How can you create a responsive web page?

A responsive web page is designed to adjust its layout and


appearance based on the size of the user's device screen. We can
create responsive web pages using CSS media queries, which allow
us to apply different styles based on the size of the viewport. We can
also use flexbox, and a flexible grid system, to make a web page
more responsive.

10. What is semantic HTML?

Semantic HTML is a type of HTML that uses elements with specific


meanings to describe the structure and content of a web page. It
allows web browsers, search engines, and assistive technologies to
better understand the purpose of each element on the page.

Some examples of semantic HTML elements are: <header>, <nav>,


<main>, <article>, and <footer>.

All rights reserved geekshelp.in 2021-23


11. How do you create links in HTML?

In HTML document links are created using <a> tag. And it contains a
href attribute that specifies the URL of the page which you want to
link. The text which is inside the opening and closing of <a> tags is
the text that will be displayed as the link.

12. What is the difference between block-level elements and inline


elements in HTML?

Block-level elements are elements that create a new block


formatting context. And HTML Block level elements take up the full
width of the parent container. Examples of block-level elements are:
<div>, <h1> to <h6>, and <p>.

HTML Inline Elements are elements that are placed inline with the
text and only take up as much width as necessary. Examples of
inline elements are: <a>, <strong>, <em>, and <span>.

13. How do you create tables in HTML?

Tables in HTML are created using the <table> element. In HTML


document table rows are defined using <tr> element and cells are
defined using <td> element. The <th> element is used to create theh
header cells of the table, which are typically used for column or row
labels.

All rights reserved geekshelp.in 2021-23


14. What is the purpose of the <form> element in HTML?

The <form> element in HTML is used to create forms in HTML. Forms


allow the users to input data, like text, numbers, select options,
checkboxes, radio buttons, etc. The form data is then typically
submitted to a server-side script for processing.

15. How do you create input fields in an HTML form?

In an HTML document input fields are created using the <input>


element. The type attribute in <input> fields specifies the type of
input field, such as text, password, checkbox, and radio button. And
the <textarea> element can be used to create a multi-line input field
in an HTML form.

16. What is the difference between a division tag (<div>) and a


section tag (<section>) in HTML?

In HTML the <div> is known as the division tag. The <div> tag is a
block-level element in HTML. Block-level element only represents
their child elements and doesn’t have a special meaning. The <div>
element takes the whole width available on the screen.

The <section> tag is a semantic element that represents a


standalone section of a document. The main advantage of the
section tag is that it describes its meaning on a web page. The
<section> tag is mostly used when we need to create headers,
footers, or any other section of documents in web page.

All rights reserved geekshelp.in 2021-23


17. What is the HTML article element?

In an HTML document, the <article> tag specifies independent, self-


contained content. The <article> element is one of the new
sectioning elements in HTML5. The content inside an <article>
element should make sense on its own and have a distinct
structure, with a title, introductory text, headings, subheadings, and
so on.

18. What is a marquee?

In HTML, the marquee is a non-standard HTML element. It is used to


create an automatic scroll up, down, left, or right text.

19. How to add a favicon in HTML?

Favicon in HTML document can be added using the code given


below. We have to add the code in the <head> section of our HTML
code.

20. What is the button tag in HTML5?

Button tag to create a button in the HTML document that will be


displayed on the web page. We can create a Button inside a form
or outside the form in the HTML document. We can use the button
as a "submit", "reset" or "cancel" button.

Must Check: JavaScript Interview Question and Answers

All rights reserved geekshelp.in 2021-23

You might also like