HTML Interview Questions

 

html interview questions and answers

 

HTML Interview Questions and Answers for beginners as well as experienced persons will help to crack HTML Interviews and also it will increase your knowledge related to HTML. We will discuss popular interview questions on HTML and will see how these are very effective.

Below is the list of top selected HTML interview questions for all type of professionals.

List of HTML Interview Questions and Answers

  1. What is HTML?
  2. Why HTML is used?
  3. What is a tag in HTML?
  4. Which HTML tag is used to create the HTML file?
  5. What is a Head tag in HTML?
  6. What are various heading tags in HTML?
  7. How to save the HTML file?
  8. What do mean by ending tag in HTML?
  9. Where to put the head tag in HTML?
  10. Which tag is used to start a paragraph in HTML?
  11. What is an HTML element?
  12. How to draw a horizontal line in HTML?
  13. Which tag is used to break the line in HTML?
  14. What are HTML attributes?
  15. How to show an image in HTML?
  16. What is the purpose of the alt attribute in img tag in HTML?
  17. How to create a link tag in HTML?
  18. How to create a table in HTML?
  19. What is the full form of tr, td, th in table?
  20. How to create a list in HTML?
  21. What is an ordered and unordered list in HTML and how to create them?
  22. How to open a link in another tab in the browser?
  23. How to scroll a text in HTML?
  24. Which tag is used to bold the text?
  25. How to change text to italic in HTML?
  26. How to change the background color of HTML page?
  27. What is span tag in HTML?
  28. How to create Email link in HTML?
  29. How to create telephone link in HTML?
  30. How to create a button in HTML?
  31. How to set the name of button in HTML?
  32. What is nav tag in HTML?
  33. How to create a form in HTML?
  34. What is the difference between get and post?

 

A list of popular HTML Interview Questions and Answers will give you the confidence to clear the HTML Interview. We will read various interview questions on HTML.

1. What is HTML?

The full form of HTML is HyperText Markup Language. HTML is a Scripting language that is used to design web pages.

 

2. Why HTML is used?

HTML is a web scripting language that is used to develop or design web pages. Unique and well-designed pages can be designed with HTML.

 

3. What is a tag in HTML?

Tags are an integral part of HTML. Anything in HTML is performed within tags.

  • Tags are predefined keywords put inside <>.
  • Every tag has its corresponding ending tag </>.

 

4. Which HTML tag is used to create the HTML file?

An HTML file is created inside <html> </html> tag.  Everything is written inside <html> </html>tag.

 

5. What is a Head tag in HTML?

The head tag is the first tag after the <html> tag. Syntax of head tag is <head> </head>. The head tag provides the information on the page. it contains meta information, any script, or any style sheet. Its a head section of any web page.

Anything related to head tag is written in <head> </head> tag.

 

6. What are various heading tags in HTML?

The heading tags are used to provide the headings on the web page. There are 6 heading tags in HTML.

<h1>, <h2>, <h3>, <h4>, <h5>, <h6> are 6 heading tags in HTML.

 

7. How to save the HTML file?

The HTML file is saved with .html extension.

 

8. What do mean by ending tag in HTML?

In HTML, every tag has its ending tag. The purpose of ending the tag is to inform us that tag content is completed and we can write any other text or another tag.

 

9. Where to put the head tag in HTML?

The head tag <head> is placed at the starting of the document after <html> tag.

 

10. Which tag is used to start a paragraph in HTML?

<p> tag is used to start a paragraph tag in HTML. Text for paragraph is written inside <p> text </p>.

 

11. What is an HTML element?

In HTML, content inside tag is considered as HTML element.  e.g.<p> Hello ByteArray.in </p> is the paragraph. Full content starting from <p> and ending at </p> is considered as HTML element.

 

12. How to draw a horizontal line in HTML?

<hr> tag is used to draw horizontal line in HTML.

 

13. Which tag is used to break the line in HTML?

<br/> tag is used to break the line in HTML.

 

14. What are HTML attributes?

HTML attributes are used with tags in HTML. These are the properties that provide additional information.

 

15. How to show an image in HTML?

img <img> tag is used to show an image in HTML.

e.g. <img src=”path_of_the_image” height =”height_of_image” width=”width_of_image“>

height and width are optional. src is a mandatory attribute.

 

16. What is the purpose of the alt attribute in img tag in HTML?

Alt Attribute provides the alternate text to the image. if by chance the image does not load, the Alt text appears in the place of the image.

 

17. How to create a link tag in HTML?

Any link is created through an anchor <a>tag in HTML. few attributes we have to pass in the anchor tag.

<a href ="URL"> anchor_text </a>
  • href is the attribute.
  • URL is the URL of the page.
  • anchor_text is the text on which the link will be displayed.

example:

<a href ="https://www.google.com/">google</a>

 

18. How to create a table in HTML?

<table> tag is used to create a table in HTML.


<html>
<body>

<table>
<tr>
<td> data in table</td>
</tr>
</table>

</body>
</html>

 

19. What is the full form of tr, td, th in table?

Tr – refer to the row in the table.

Td– refer to table data.

Th – refer to the table heading.

 

20. How to create a list in HTML?

List in HTML is created through <ul> tag. Inside <ul> tags, list items are added through <li> tag.


<html>
<body>

<h2>HTML List</h2>

Apple
Banana
Orange


</body>
</html>


 

Output

HTML List

Apple
Banana
Orange

 

21. What is an ordered and unordered list in HTML and how to create them?

Ordered List

An ordered list is that list in which list items are represented with ordered numbers say 1,2, 3 etc. Ordered list is created with<ol> tag.

Example


<html>
<body>

<h2>Ordered List</h2>;

<li>Applel</li>
<li>Banana</li>
<li>Orange</li>

</body>
</html>

output

Ordered List
Apple
Banana
Orange

 

Unordered List

In an Unordered list, items are not represented with numbers. Unordered list is created with <ul> tag.

Example


<html>
<body>

<h2>Unordered List</h2>

<ul>
<li>Apple</li>
<li>Banana</li>
<li>Orange</li>
</ul>

</body>
</html>

Output

Unordered List

Apple
Banana
Orange

 

22. How to open a link in another tab in the browser?

link can be opened in another browser by using the attribute target=”_blank” in the anchor tag.

<a href="https://www.google.com/" target="_blank">google</a>

 

23. How to open a link in another tab in the browser?

Using marquee tag <marquee> text can be scrolled in the webpage.

<marquee> scrolled text</marquee>

 

24. Which tag is used to bold the text?

<b> tag is used to bold the text. Any text you want to bold, put that inside <b> and </b>

<b> This is bold text </b>

 

25. How to change the text to italic in HTML?

Using italic tag <i> text can be changed to the italic font.

 

26. How to change the background color of an HTML page?

The background color of the webpage can be changed by using bgcolor attribute in the body tag.

<body bgcolor="red">

 

 

27. What is a span tag in HTML?

Span is an element of HTML. span tag is start with <span> and end with </span>. The span tag is used to phrase the content inside the container.

 

28. How to create an Email link in HTML?

The email link is the anchor tag when you click on an email that will be sent to the sender. Email link is created by putting mailto in href attribute. see below

<a href ="mailto:example@website.com">Send Email </a>

 

29. How to create a telephone link in HTML?

A telephone link can be created by using tel inside href attribute of the anchor tag in HTML.

<a href="tel:+911000000000">+911000000000</a>

 

30. How to create a button in HTML?

Button is created through button tag <button> tag in HTML

<button type="button">this is button</button>

 

31. How to set the name of the button in HTML?

The name of the button is set through the name attribute of the button tag. Value attribute is used to set the value of the button.

<button type="button" name="click" value="HTML">HTML </button>

 

32. What is nav tag in HTML?

The nav means navigation. Nav tag is used to create the navigation link in any webpage. Header navigation links can be created through nav tag.

<nav>

 <a href="#home"> home </a>

<a href="Tutorial">Tutorial</a>

</nav>

 

33. How to create a form in HTML?

Form ic created with <form> tag in HTML. Inside <form> tag.

 

34. What is the difference between get and post?

Get and post are two methods in Form, which is used to transfer the form data from HTML to some backend server to process.

GET POST
1. Form data is transferred in the URL String 1. Form data is transferred in the form body
2. Get is not recommended to send private data like passwords or secret data. 2. Post is recommended to send private data.
3. 1024 bytes of data can be sent through GET method 3. Upto 2 MB of data can be transferred through the POST method.

 

Above we saw the top HTML Interview Questions and Answers. We will update from time to time interview questions on HTML, so keep visiting our page to see more and more HTML interview questions and answers.