HTML Interview Questions and Answers

1. What is HTML?

HTML abbreviated as a “hypertext markup language”  HTML used to describe the structure of a website; TEXT becomes more interactive and dynamic by using HTML.

2. Write syntax for an HTML document?

<!DOCTYPE html>

<html>

<head>

<title> tekslate </title>

</head>

<body>

<h1> interview questions </h1>

<p> paragraph </p>

</body>

</html>

3. Explain about HTML elements?

Element is a component of HTML webpage which represents the meaning or semantics.

4. Explain about HTML tags?

HTML Tags is the root of an HTML document which used to specify that the particular document is an HTML document

5. How to add a link in HTML document?

We can add a link in the HTML document using the below syntax

<a href="https://tekslate.com/">This is a link</a>

6. Explain about HTML attributes?

Attributes give meaning to the elements these are always specified in starting tag this comes typically in name/value pair, for example, like name=” value”.

7. How many types of headings are there in HLTM?

There are 6 types of Headings in HTML from <h1></h1> to <h6></h6>

8. How to add background color in HTLM document?

<body style= “background-color:red;”>

<h1> tekslate </h1>

<p1> this is tekslate html training </p1>

</body>

9. Write a syntax to change fonts in HTML?

<h1 style=”font-family:times;”> tekslate </h1>

10. What are the Block level elements?

A block-level element is described as a block that enlarges to fill the full width achievable to it that is, the breadth of its container and will constantly begin on a distinct line.

Elements which are block-level by default are- <div>, <img>, <section>, <form>, <nav>.

11. What are Inline elements?

Inline elements are described where they are set and only take up period that is required. The most obvious way to know how they work is to see at whereby text slides on a page.

Elements which are inline by default are- <span>, <b>, <strong>, <a>, <input>. 

12. List a few standard lists used when designing a page?

  • Ordered list
  • Unordered list
  • Definition list

13. What is the formatting?

The formatting in HTML is a method of format the text for a more solid look and sense. It utilises various tags to compose text bold, emphasised and underlined. 

14. Write syntax for the unordered list?

<ul>

<li>apple</li>

<li>mango</li>

<li>banana</li>

</ul>

15. Write syntax for the ordered list?

<ol>

<li>apple</li>

<li>mango</li>

<li>banana</li>

</ol>

16. What is an HTML class?

The class is an attribute which defines one or more class titles for an HTML element. The class attribute can be utilised on any HTML element. The class name can be used by CSS and also JavaScript to accomplish specific tasks for elements with the designated class name.

17. In how many ways CSS can be added to HTML?

We can add CSS to HTML in 3 following ways

  • Inline 
  • Internal 
  • External 

18. What is the use of id Attribute?

The id attribute designates a different id for an HTML element. The id attribute mostly utilised to lead a style in a style sheet, and with JavaScript to handle the element with the particular id.

19. What is the use of iframe in HTML?

Iframe in HTML stands for an inline frame this is utilised to implant another document inside the existing HTML document.

20. Explain about semantic HTML?

Semantic HTML is a coding technique. It is the utilised by HTML markup to strengthen the semantics of the content. For instance: In semantic HTML tags <b> </b> is never utilised for bolding any particular  statement as well as the following tag <i> </i> is utilised for italic. Rather these tags we can also utilise the tags like <strong></strong> and <em></em> 

21. Explain about style sheet?

A style sheet utilised to create a steady, transportable, and well-planned style template. You can add those templates on various web pages. It defines the appearance and formatting of a document composed in the markup language.

22. Explain about image map?

Image map helps you to link several various web pages utilising a single image. It is designed by <map> tag. You can describe shapes in images that you need to take part in an image mapping.

23. What are HTML file paths?

An HTML file path is utilised to specify the location of a file within a website folder. File paths are similar to an address of the file to a web browser. We can link any external source to join in our HTML file by the help of file paths such as pictures, file, CSS file, JS file, video and so on.

24. What are HTML character entities?

An HTML entity is a portion of text or “string” that starts with an ampersand”&” and ends with a semicolon”;”. Entities usually utilised to represent saved characters and characters like non-breaking spaces.

25. What is the text-indent?

Text-indent is the Arrangement at the origin of the initial line in a block of text. The straight indentation will use to the left of the text in a standard Western left-to-right organisation or the right of the text in a right-to-left design.

26. Can we modify the colour of the bullet?

The colour of the bullet is constantly the colour of the initial text of the list. So, if you need to modify the colour of the bullet, you should modify the colour of the text.

27. Is <!DOCTYPE html> tag a HTML tag?

No, <!DOCTYPE html> declaration tag is not a html tag

28. What are empty elements?

The elements without any content are called empty elements <hr> and <br> ate two empty elements

29. What are the uses of a span tag?

  • The span tag used to add colour on text
  • We can add background by using a span tag
  • We can highlight the text

30. What is the use of collapsing white space?

White spaces are a blank series of space characters, which handled as a single space character in HTML. Because the browser collapses multiple spaces into an individual space, you can order lines of text without bothering about various spaces. White space allows you to make the HTML code into an extremely more understandable format.