Latest Top 20 HTML Interview Questions and Answers:-
Question 1 – What is HTML and why is it used?
Answer – The full form of HTML is HyperText Markup Language. HTML is a scripting language to create web applications/pages. It is backbone of web applications.
Question 2 – Why is “alt” attribute used in HTML tag?
Answer – In an image, the alt attribute provides option text of an image. If image is not loaded in the HTML page, then alt text displayed. It also helps us for SEO ( Search Engine Optimization ).
Question 3 – How many heading tags in HTML?
Answer – 6 are heading tags of HTML. HTML headings tags are “
“<h1>” to “<h6>”.
Question 4 – What is the difference between XHTML and HTML?
Answer – The full form of XHTML is Extensible HyperText Markup Language and HTML stand for HyperText Markup Language. XHTML attribute values must be enclosed in double or single quotes. But in HTML no need to single or double quotes. XHTML is case-sensitive but HTML is not case-sensitive.
Question 5 – What are some tags in HTML?
Answer – HTML tag , head tag , title tag , heading tag “<h2>”, “<div>”, image tag “<img>” etc.
Question 6 – Please define the “multipart form data” value in HTML.
Answer – Multipart form data is used to send the file to the server-side for processing. The value of enctype is “multipart/form-data”. example –
<form action="test.php" method="post" enctype="multipart/form-data"> <input type="submit" value="Submit"> </form>
Question 7 – What is the meaning of charset=”UTF-8″ in meta tag?
Answer – In meta tag “UTF-8” is the specific character encoding that is used. It supports wide variety of characters, including those from different languages. It is used for displaying text correctly across different-different browsers & different-different devices.
Question 8 – What is the difference between HTML and HTML5?
Answer – In simple HTML uses tags such as headings (“<img>”, “<h1>” to “<h6>”). In HTML5, some new tags are added such as “<header>”, “<footer>”, “<section>”, and “<article>”. In HTML5, enables websites to access a user’s geographical location. but old HTML is not supported. Simple HTML is not mobile friendly but HTML5 language more mobile-friendly.
Question 9 – How do you create a HTML table?
Answer – Example
<!DOCTYPE html>
<html>
<head>
<title>Page Title Name</title>
</head>
<body>
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Text 1</td>
<td>Text 2</td>
</tr>
</table>
</body>
</html>
Question 10 – How will you add an email link in HTML?
Answer – Example is given as bellow –
<a href="mailto:codeloveguru@gmail.com">Send Email</a>
Question 11 – How do you create a hyperlink of the any “Text” in HTML?
Answer – Example –
<a href="https://codeloveguru.com/">Click here</a>
Question 12 – How do you create Unorder List in HTML page?
Answer –
<!DOCTYPE html>
<html>
<head>
<title>HTML Unordered List</title>
</head>
<body>
<h3>Example of Unordered HTML List</h3>
<ul>
<li>Ashok</li>
<li>Pramod Kumar</li>
<li>Prasoon</li>
</ul>
</body>
</html>
Top 20 HTML Interview Questions and Answers