Home Videos Exercises MCQ Q&A Quiz E-Store Services Blog Sign in Appointment Payment

HTML Interview Questions And Answers

SOOPRO Pathshala provides HTML Interview Questions and Answers


1. What is HTML?

HTML stands for HyperText Markup Language . It is the language for creating webpages.


2. What are HTML tags?

HTML tags are the keywords that are used to produce web pages in various formats.


3. What is a marquee in HTML?

Marquee is used for scrolling text on a web page.


4. What are HTML Attributes?

Attributes are the properties that can be added to an HTML tag.


5. What is use of b tag?

b tag is used to display the written text in bold format.


6. What is use of i tag?

i tag is used to display the written text in italic format.


7. What is use of u tag?

u tag is used to display the written text in underline format.


8. What is use of strong tag?

makes text strong


9. Who is developer of HTML?

Tim Berners-Lee


10. In which year HTML was invented?

1991


11. What is the current version of HTML?

HTML 5


12. Extension of saving HTML file are?

.HTML or .HTM


13. Total tags in HTML are?

140


14. What is use of head tag?

The head tag contains meta information about the document


15. What is use of title tag?

The title element specifies a title for the document


16. What is use of body tag?

The body tag contains the visible page content


17. What is use of h1 tag?

The h1 tag defines a large heading


18. What is use of h6 tag?

The h1 tag defines a smallest heading


19. What is use of doctype html tag?

The declaration defines this document to be HTML5


20. What is use of p tag?

The tag defines a paragraph


21. Differentiate between an ordered list and an unordered list.

An unordered list uses <ul> </ul> tags, and each element of the list is written between <li> </li> tags. The list items are displayed as bullets rather than numbers.

An ordered list uses <ol> </ol> tags, and each element of the list is written between <li> </li> tags. The list items are displayed as numbers rather than bullet points.


22. What is an element in HTML?

An element in HTML is a set of tags that define a specific part of a web page. It consists of a start tag, content, and an end tag.


23. What is the difference between HTML and CSS?

HTML creates a web page's structure and content, while CSS defines its appearance and layout.


24. What is white space in HTML?

An empty sequence of space characters is called white space in HTML. It is considered a single-space character.


25. What is the alt attribute in HTML?

The alt attribute displays text in place of an image whenever the image cannot be loaded due to technical issues.


26. What is the role of the meta tag in html?

The <meta> tag provides additional information about the web page, such as the author, description, and keywords. It is located within the <head> section of the HTML document.


27. What is the difference between HTML and HTML5?

HTML 5 is the updated version of HTML. What makes this newer version of HTML better is the added features that support audio, video, and new styling elements which differ from old version.


28. Must all HTML tags be closed?

No, Not all tags need to be closed. There are self-closing tags that don't require closing tags.


29. What is semantics in HTML?

Semantics in HTML are styles used to define the meaning of content elements in webpages. It provides meaning to the tags and code written.


30. How do you underline text in HTML

You can underline text by simply using the <u> tag.


31. How do you add a button in HTML

You can add a button to an HTML page by using the button tag.


32. What is a span tag used for?

A tag used for marking up a part of the text or document. It can also be used to group elements together for styling purposes.


33. What is SVG?

SVG stands for scalable vector graphics. It is used to describe visuals in XML language.


34. What is !DOCTYPE?

The !DOCTYPE is an instruction used by web browsers to determine the version of HTML the website is written in.


35. How do you define headings in HTML?

HTML headings are defined using the <h1> to <h6> tags.

<h1> defins the most important heading with the biggest font size.

<h6> defines the least important heading and has the smallest font size.


36. How to create a table in HTML?

To create a basic table in HTML:

Use the <table> tag to define the table.

Create rows with the <tr> tag.

Define headers using the <th> tags.

Add data cells using <td> (table data) tags.


37. How to change text color in HTML

You can use the color property in CSS to change the color of text in HTML.


38. How to Add a scroll bar in HTML?

To add a scroll bar in HTML, you can use CSS to control the overflow behavior of an element.


39. How to add a footer in HTML?

To add a footer in HTML, you can use a <footer> element or a <div> element with an appropriate class or ID.


40. How to create a Form in HTML?

To create a form in HTML, use the <form> element. Inside this element, add various input fields using different HTML elements such as <input>, <textarea>, <select> and more.


41. What is the difference between <div> and <span> tag?

The <div> and <span> tags are both HTML elements used for grouping and structuring content, but they have different objectives.

<div> is a block-level element, which starts on a new line and takes up the full width available by default.


42. How to embed audio in an HTML document?

To embed audio in an HTML document, use the <audio> element.


43. What is HTML Encoding?

HTML encoding refers to converting special characters in HTML into their respective character entities.


44. How do you optimize an HTML Page's load time?

Optimize the load time of an HTML page by scalling down image and media sizes, compressing CSS and JavaScript files, merging files to decrease HTTP requests, and using lazy loading for non-urgent scripts and images.


45. What is the role of the onblur() method?

The onblur() method specifies actions to take when an element loses focus. This frequently validates input fields before users move to the next field.


46. What is an anchor tag in HTML?

The <a> tag in HTML defines a hyperlink, allowing navigation from one page to another.


47. Full form of HTML

Hypertext Markup Language.


48. How do you add comments in HTML

Comments in HTML can be added using the syntax.


49. What is the difference between block-level and inline elements in HTML?

Block-level elements in HTML start on a new line and occupy the full available width of their parent container. Examples of block-level elements include <div>, <p>, <h1> to <h6>, and <li>. Inline elements, on the other hand, do not create line breaks and only occupy the necessary width for their content. Examples of inline elements include <span>, <a>, <strong>, and <em>.


50. What is the purpose of the "colspan" attribute in an HTML table?

The "colspan" attribute in an HTML table is used to specify the number of columns that a table cell should span or occupy.s