TQL

logo

Welcome To Ask Me

1. Are the HTML tags and elements the same thing?

No. HTML elements are defined by a starting tag, may contain some content and a closing tag.For example, <h1>Heading 1</h1> is a HTML element but just <h1> is a starting tag and </h1> is a closing tag.

2. What are tags and attributes in HTML?

Tags are the primary component of the HTML that defines how the content will be structured/ formatted, whereas Attributes are used along with the HTML tags to define the characteristics of the element. For example, <p align=” center”>Interview questions</p>, in this the ‘align’ is the attribute using which we will align the paragraph to show in the center of the view.

3. What are void elements in HTML?

HTML elements which do not have closing tags or do not need to be closed are Void elements. For Example <br />, <img />, <hr />, etc.

4. What does HTML stand for?

HTML stands for Hyper Text Markup Language. HTML is the standard markup language for creating Web pages.

5. What are HTML Entities?

In HTML some characters are reserved like ‘<’, ‘>’, ‘/’, etc. To use these characters in our webpage we need to use the character entities called HTML Entities. Below are a few mapping between the reserved character and its respective entity character to be used.

6. What is the ‘class’ attribute in HTML?

The class attribute is used to specify the class name for an HTML element. Multiple elements in HTML can have the same class value. Also, it is mainly used to associate the styles written in the stylesheet with the HTML elements.

7. What is the difference between the ‘id’ attribute and the ‘class’ attribute of HTML elements?

Multiple elements in HTML can have the same class value, whereas a value of id attribute of one element cannot be associated with another HTML element.

8. Describe HTML layout structure.

Every web page has different components to display the intended content and a specific UI. But still, there are few things which are templated and are globally accepted way to structure the web page, such as:

  • <header>: Stores the starting information about the web page.
  • <footer>: Represents the last section of the page.
  • <nav>: The navigation menu of the HTML page.
  • <article>: It is a set of information.
  • <section>: It is used inside the article block to define the basic structure of a page.
  • <aside>: Sidebar content of the page.

9. What are the various formatting tags in HTML?

 HTML has various formatting tags:

  • <b> – makes text bold
  • <i> – makes text italic
  • <em> – makes text italic but with added semantics importance
  • <big> – increases the font size of the text by one unit
  • <small> – decreases the font size of the text by one unit
  • <sub> – makes the text a subscript
  • <sup> – makes the text a superscript
  • <del> – displays as strike out text
  • <strong> – marks the text as important
  • <mark> – highlights the text
  • <ins> – displays as added text

10. What are the different kinds of Doctypes available?

 HTML has various formatting tags:

  • <b> – makes text bold
  • <i> – makes text italic
  • <em> – makes text italic but with added semantics importance
  • <big> – increases the font size of the text by one unit
  • <small> – decreases the font size of the text by one unit
  • <sub> – makes the text a subscript
  • <sup> – makes the text a superscript
  • <del> – displays as strike out text
  • <strong> – marks the text as important
  • <mark> – highlights the text
  • <ins> – displays as added text

11. What is white space in HTML?

An empty sequence of space characters is called the white space in HTML. This white space is considered as a single space character in the HTML.

White space helps the browser to merge multiple spaces into one single space, and so taking care of indentation becomes easier. White space helps in better organizing the content and tags, making them readable and easy to understand.

12. How do you create a hyperlink in HTML?

We use the anchor tag <a> to create a hyperlink in HTML that links one page to another page. The hyperlink can be added to images too. 

13. What is a marquee?

Marquee is used to put the scrolling text on a web page. It scrolls the image or text up, down, left or right automatically. You should put the text which you want to scroll within the <marquee>……</marquee> tag.

14. Why do we use a style sheet in HTML?

A style sheet helps in creating a well-defined template for an HTML webpage that is both consistent as well as portable. We can link a single style sheet template to various web pages, which makes it easier to maintain and change the look of the website.

15. Explain the use of an iframe tag.

The <iframe> tag specifies an inline frame. It is used to display a web page within a web page (to embed another document within the current HTML document). 

For example – The src attribute is used to specify the URL of the document that occupies the iframe.

Syntax: 

<iframe src=”URL”></iframe>

16. How to create multi-colored text on a web page?

We can use <font color =”color”> </font> to create multi-colored text on a web page for the specific texts that you want to color.

17. What are the different new form element types in HTML 5?

Following is a list of 10 frequently used new elements in HTML 5:

  • Color
  • Date
  • Datetime-local
  • Email
  • Time
  • Url
  • Range
  • Telephone
  • Number
  • Search

18. What is the advantage of collapsing white space?

In HTML, a blank sequence of whitespace characters is treated as a single space character, Because the browser collapses multiple spaces into a single space character and this helps a developer to indent lines of text without worrying about multiple spaces and maintain readability and understandability of HTML codes.

19. Which HTML tag is used to display the data in the tabular form?

The HTML table tag is used to display data in tabular form (row * column). It also manages the layout of the page, e.g., header section, navigation bar, body content, footer section. Here is the list of tags used while displaying the data in the tabular form:

TagDescription
<table>It defines a table.
<tr>It defines a row in a table.
<th>It defines a header cell in a table.
<td>It defines a cell in a table.
<caption>It defines the table caption.
<colgroup>It specifies a group of one or more columns in a table for formatting.
<col>It is used with <colgroup> element to specify column properties for each column.
<tbody>It is used to group the body content in a table.
<thead>It is used to group the header content in a table.
<tfooter>It is used to group the footer content in a table.

20. What are some common lists that are used when designing a page?

There are many common lists which are used to design a page. You can choose any or a combination of the following list types:

  • Ordered list – The ordered list displays elements in numbered format. It is represented by <ol> tag.
  • Unordered list – The unordered list displays elements in bulleted format. It is represented by <ul> tag.
  • Definition list – The definition list displays elements in definition form like in dictionary. The <dl>, <dt> and <dd> tags are used to define description list.

21. How to create a nested webpage in HTML?

The HTML iframe tag is used to display a nested webpage. In other words, it represents a webpage within a webpage. The HTML <iframe> tag defines an inline frame. For example:

  1. <!DOCTYPE html>    
  2. <html>    
  3. <body>    
  4. <h2>HTML Iframes example</h2>    
  5. <p>Use the height and width attributes to specify the size of the iframe:</p>    
  6. <iframe src=“https://www.javatpoint.com/” height=“300” width=“400”></iframe>    
  7. </body>    
  8. </html>    

22. Explain the layout of HTML?

HTML contains different elements that define the structure of a web page:
  • <header>:This defines a header for a web page
  • <nav>: This defines a container for navigation links
  • <section>: This defines a section in a web page
  • <article>: This is the primary element that contains information about the web page
  • <aside>: The <aside> content is often placed as a sidebar in a document
  • <footer>: This defines a footer for a document or a section
  • <details>: This is used to define additional details
  • <summary>: This defines a heading for the <details> element

23. What is the use of a span tag? Give one example.

The span tag is used for following things:

  • For adding color on text
  • For adding background on text
  • Highlight any color text

24. Does a tag is a HTML tag?

No, the <!DOCTYPE html> declaration is not an HTML tag. There are many type of HTML e.g. HTML 4.01 Strict, HTML 4.01 Transitional, HTML 4.01 Frameset, XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1 etc. So, <!DOCTYPE html> is used to instruct the web browser about the HTML page.

25. Which type of video formats are supported by HTML5?

HTML 5 supports three types of video format:

  • mp4
  • WebM
  • Ogg

26. What is button tag?

The button tag is used in HTML 5. It is used to create a clickable button within the HTML form on the web page. It is generally used to create a “submit” or “reset” button. Let’s see the code to display the button.

<button name=“button” type=“button”>Click Here</button>    

27. How are comments added in HTML?

The comment tag (<!– Comment –>) is used to insert comments in the HTML code.

Types of HTML Comments: There are three types of comments in HTML which are:

 
  • Single-line comment
  • Multi-lines comment
  • Using <comment> tag

28. What is the use of alt attribute in images?

The <img> alt attribute is used to specify the alternate text for an image. It is useful when the image is not displayed. It is used to give alternative information for an image.

Syntax:

<img alt="text">

29. How to add a favicon in HTML?

Below is the code to add a favicon. Access the code of your webpage and in the <HEAD> section add the following code. 

<link rel=”icon” type=”image/png” href=”/favicon.png”/> 

30. What is an empty element?

 An empty element is an HTML element that has no content. Example <br>