HTML Interview Questions and Answers

HTML Interview Questions and Answers

Q.1.How do you add a copyright symbol on a HTML page?

Ans.Copyright symbol can be either copied and pasted from other sources. Or, you can also add it by writing a small piece of code: © or & #169; in the required page.

Q.2.What’s one main result if you do not specify a doctype in an HTML page?

Ans. New HTML5-specific tags will not be interpreted by the browser.

Q.3. What does DOCTYPE mean?

Ans. DOCTYPE or Document Type Declaration is a type of instruction which usually works in association with particular SGML or XML documents basically. Let us take an example to understand it more thoroughly, for example, A Web page with a document type definition i.e. DTD is the best to understand. In a well serialized and a proper form of the document, It manifests and also the contribution of it is a lot as a short string of markup that usually conforms to a particular syntax.

Q.4. What is HTML and what is it used for?

Ans.HTML is a widely used language that gives our webpage a structure. HTML stands for HYPERTEXT MARKUP LANGUAGE. HTML was created by Berners lee in 1991. A markup language is a set of markups tags. Every webpage is created in HTML. HTML documents are described in HTML tags.

Q.5. What is a physical tag and logical tag in HTML?

Ans. A Physical tag has physical text which is used to tell the browser how to display the text enclosed in the physical tag.Example for the physical tags are:Logical tags are used to tell the meaning of the enclosed text in it. The example of the logical tag is …. tag. When we enclose text in Important tag then it tell the browser that enclosed text is more important than other text.

Q.6. What is the purpose of using alternative texts in images?

Ans. The basic purpose of using alternative texts is to define what the image is about. During an image mapping, it can be confusing and difficult to understand what hotspots correspond to a particular link. These alternative texts come in action here and put a description at each link which makes it easy for users to understand the hotspot links easily.

Q.7.What is an image map?

Ans.Image mapping lets a user to link one image to different web pages in and out of the website. It is the process of defining special shapes inside an image and link it to different destinations.

Q.8. What is Cell Spacing and Cell Padding?

Ans.Cell Spacing is referred to space/gap between the two cells of the same table.
Cell Padding is referred to the gap/space between the content of the cell and cell wall or Cell border.
Example:

Q.9.What is grouping in HTML?Ans. Grouping is used to group several HTML controls like input, textarea, selects as well as labels (

element is used for Grouping.

Q.10. What is the XHTML?

Ans.XHTML means Extensible Hypertext Markup Language, which is basically a part of Family of XML markup language. It usually extends the most popularly used HTML i.e. Hypertext Markup Language, the pages in which the web pages are formulated.

Q.11. How to create mailto link in HTML

Ans.Basically, when we usually start with a hyperlink that is Mailto rather than using HTTP or others, the browser should be able to compose an email in the visitor’s default email program on their computer. There are two ways to insert a mailto link into a HubSpot page or email, just by inserting a hyperlink into the rich editor or inputting into the source code. Option one is basically nothing just to insert a mailto link as a hyperlink, also highlight the text or click on the image as you wish.to apply on the mailto link to for your contacts or visitors to click on and finally click Add the link to finish. Option two is to Insert a mailto link into the source code and Click Save to finish then Publish or Update your page.

Q.12.What is the difference between DIV and SPAN in HTML?

Ans.The difference between span and div is that a span element is in-line and usually used for a small chunk of HTML inside a line (such as inside a paragraph) whereas a div (division) element is block-line (which is basically equivalent to having a line-break before and after it) and used to group larger chunks of code.

This is crazy

Q.13.What is “Semantic HTML” ?

Ans. Semantic HTML or Semantic Markup is HTML that introduces meaning to the web page rather than just presentation.

,

, andare examples of Semantic Elements.Below are the list of few new Semantic Elements introducted HTML.

 

 

 

 

 

 

 

 

Q.14.What is the difference between a tag and an element in HTML?

Ans. HTML tag is just opening or closing entity.Example:

and

are called HTML tagsHTML element encompasses opening tag, closing tag, content (optional for content-less tags)Example:

This is the content

.: This complete thing is called an HTML element

Q.15.List the media types and formats supported by HTML ?

Ans. HTML supports a wide range of media formats for sound, music, videos, movies, and animations. Below is the list extensions supported by each media format.
Media Type Formats Supported
Images png, jpg, jpeg, gif, apng, svg, bmp, bmp ico, png ico
Audio MIDI, RealAudio, WMA, AAC, WAV, Ogg, MP3, MP4
Video MPEG, AVI, WMV, QuickTime, RealVideo, Flash, Ogg, WebM, MPEG-4 or MP4

Q.16.List the media types and formats supported by HTML ?

Ans. In HTML, we have two types of lists unordered lists and ordered lists. Unordered list starts with

    tag and ends with

tag. Ordered tag starts with

    and ends with

. Each list item is written as

Q.17. How are active links different from normal links?

Ans.The default color for normal and active links is blue. Some browsers recognize an active link when the mouse cursor is placed over that link; others recognize active links when the link has the focus. Those that don’t have a mouse cursor over that link is considered a normal link.

Q.18. What is

in HTML5?Ans.This tag represents a piece of self-contained flow content. It is mostly used as a single unit as a reference the main flow of the document.Q.19.What is the use of Canvas element?Ans.The canvas element helps to build charts, graphs, bypass Photoshop to create 2D images and place them directly into HTML5 code.Q.20.What are the new FORM elements which are available in HTML5?Ans.The new Form elements in HTML5 offers much better functionality than the earlier versions.The new Form elements in HTML5 offers much better functionality than the earlier versions.The tags given provided to carry out these functions are:1)– This tag is use to specify a list of options for input controls.2) – This tag represents a key-pair generator field.3) – It represents the result of any scripting calculation.Q.21.Do all HTML tags have an end tag?Ans. There are some HTML tags that don’t need a closing tag. For example:img tag, hr tag, br tag, meta tag etc.Q.22.What is formatting in HTML?Ans. The HTML formatting is a process of format the text for a better look and feel. It uses different tags to make text bold, italicized, underlined.Q.23.How to create a hyperlink in HTML?Ans. The HTML provides an anchor tag to create a hyperlink that links one page to another page. These tags can appear in any of the following ways:
Unvisited link – It is displayed, underlined and blue.
Visited link – It is displayed, underlined and purple.
Active link – It is displayed, underlined and red.
Q.24.What are some common lists that are used when designing a page?Ans. 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

    1. tag.
    1. Unordered list – The unordered list displays elements in bulleted format. It is represented by

      • tag.
      • Definition list – The definition list displays elements in definition form like in dictionary. The
,

and
tags are used to define description list.

Q.25.What is a marquee?

Ans. 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 …… tag.

Q.26.How many tags can be used to separate a section of texts?

Ans. Three tags are used to separate the texts.

tag – Usually
tag is used to separate the line of text. It breaks the current line and conveys the flow to the next line

tag – The

tag contains the text in the form of a new paragraph.

tag – It is used to define a large quoted section. If you have a large quotation, then put the entire text within

………….

tag.

Q.27.What are empty elements?

Ans. HTML elements with no content are called empty elements. For example:
,


etc.

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

Ans. The span tag is used for following things:
For adding color on text
For adding background on text
Highlight any color text

Q.29.What is the use of an iframe tag?

Ans. An iframe is used to display a web page within a web page.

Q.30.What are the entities in HTML?

Ans. An HTML entity is a piece of text (“string”) that begins with an ampersand (&) and ends with a semicolon (;) . Entities are frequently used to display reserved characters (which would otherwise be interpreted as HTML code), and invisible characters (like non-breaking spaces)For example, the entity for the copyright symbol (©) is © “©”

Q.31.Why is a URL encoded in HTML?

Ans. An URL is encoded to convert non-ASCII characters into a format that can be used over the Internet because a URL is sent over the Internet by using the ASCII character-set only. If a URL contains characters outside the ASCII set, the URL has to be converted. The non-ASCII characters are replaced with a “%” followed by hexadecimal digits.

Q.32.Does a tag is a HTML tag?

Ans No, the 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, is used to instruct the web browser about the HTML page.

Q.1.How do you add a copyright symbol on a HTML page?

Ans.Copyright symbol can be either copied and pasted from other sources. Or, you can also add it by writing a small piece of code: © or & #169; in the required page.

Q.2.What’s one main result if you do not specify a doctype in an HTML page?

Ans. New HTML5-specific tags will not be interpreted by the browser.

Q.3. What does DOCTYPE mean?

Ans. DOCTYPE or Document Type Declaration is a type of instruction which usually works in association with particular SGML or XML documents basically. Let us take an example to understand it more thoroughly, for example, A Web page with a document type definition i.e. DTD is the best to understand. In a well serialized and a proper form of the document, It manifests and also the contribution of it is a lot as a short string of markup that usually conforms to a particular syntax.

Q.4. What is HTML and what is it used for?

Ans.HTML is a widely used language that gives our webpage a structure. HTML stands for HYPERTEXT MARKUP LANGUAGE. HTML was created by Berners lee in 1991. A markup language is a set of markups tags. Every webpage is created in HTML. HTML documents are described in HTML tags.

Q.5. What is a physical tag and logical tag in HTML?

Ans. A Physical tag has physical text which is used to tell the browser how to display the text enclosed in the physical tag.Example for the physical tags are:Logical tags are used to tell the meaning of the enclosed text in it. The example of the logical tag is …. tag. When we enclose text in Important tag then it tell the browser that enclosed text is more important than other text.

Q.6. What is the purpose of using alternative texts in images?

Ans. The basic purpose of using alternative texts is to define what the image is about. During an image mapping, it can be confusing and difficult to understand what hotspots correspond to a particular link. These alternative texts come in action here and put a description at each link which makes it easy for users to understand the hotspot links easily.

Q.7.What is an image map?

Ans.Image mapping lets a user to link one image to different web pages in and out of the website. It is the process of defining special shapes inside an image and link it to different destinations.

Q.8. What is Cell Spacing and Cell Padding?

Ans.Cell Spacing is referred to space/gap between the two cells of the same table.
Cell Padding is referred to the gap/space between the content of the cell and cell wall or Cell border.
Example:

Q.9.What is grouping in HTML?Ans. Grouping is used to group several HTML controls like input, textarea, selects as well as labels (

element is used for Grouping.

Q.10. What is the XHTML?

Ans.XHTML means Extensible Hypertext Markup Language, which is basically a part of Family of XML markup language. It usually extends the most popularly used HTML i.e. Hypertext Markup Language, the pages in which the web pages are formulated.

Q.11. How to create mailto link in HTML

Ans.Basically, when we usually start with a hyperlink that is Mailto rather than using HTTP or others, the browser should be able to compose an email in the visitor’s default email program on their computer. There are two ways to insert a mailto link into a HubSpot page or email, just by inserting a hyperlink into the rich editor or inputting into the source code. Option one is basically nothing just to insert a mailto link as a hyperlink, also highlight the text or click on the image as you wish.to apply on the mailto link to for your contacts or visitors to click on and finally click Add the link to finish. Option two is to Insert a mailto link into the source code and Click Save to finish then Publish or Update your page.

Q.12.What is the difference between DIV and SPAN in HTML?

Ans.The difference between span and div is that a span element is in-line and usually used for a small chunk of HTML inside a line (such as inside a paragraph) whereas a div (division) element is block-line (which is basically equivalent to having a line-break before and after it) and used to group larger chunks of code.

This is crazy

Q.13.What is “Semantic HTML” ?

Ans. Semantic HTML or Semantic Markup is HTML that introduces meaning to the web page rather than just presentation.

,

, andare examples of Semantic Elements.Below are the list of few new Semantic Elements introducted HTML.

 

 

 

 

 

 

 

 

Q.14.What is the difference between a tag and an element in HTML?

Ans. HTML tag is just opening or closing entity.Example:

and

are called HTML tagsHTML element encompasses opening tag, closing tag, content (optional for content-less tags)Example:

This is the content

.: This complete thing is called an HTML element

Q.15.List the media types and formats supported by HTML ?

Ans. HTML supports a wide range of media formats for sound, music, videos, movies, and animations. Below is the list extensions supported by each media format.
Media Type Formats Supported
Images png, jpg, jpeg, gif, apng, svg, bmp, bmp ico, png ico
Audio MIDI, RealAudio, WMA, AAC, WAV, Ogg, MP3, MP4
Video MPEG, AVI, WMV, QuickTime, RealVideo, Flash, Ogg, WebM, MPEG-4 or MP4

Q.16.List the media types and formats supported by HTML ?

Ans. In HTML, we have two types of lists unordered lists and ordered lists. Unordered list starts with

    tag and ends with

tag. Ordered tag starts with

    and ends with

. Each list item is written as

Q.17. How are active links different from normal links?

Ans.The default color for normal and active links is blue. Some browsers recognize an active link when the mouse cursor is placed over that link; others recognize active links when the link has the focus. Those that don’t have a mouse cursor over that link is considered a normal link.

Q.18. What is

in HTML5?Ans.This tag represents a piece of self-contained flow content. It is mostly used as a single unit as a reference the main flow of the document.Q.19.What is the use of Canvas element?Ans.The canvas element helps to build charts, graphs, bypass Photoshop to create 2D images and place them directly into HTML5 code.Q.20.What are the new FORM elements which are available in HTML5?Ans.The new Form elements in HTML5 offers much better functionality than the earlier versions.The new Form elements in HTML5 offers much better functionality than the earlier versions.The tags given provided to carry out these functions are:1)– This tag is use to specify a list of options for input controls.2) – This tag represents a key-pair generator field.3) – It represents the result of any scripting calculation.Q.21.Do all HTML tags have an end tag?Ans. There are some HTML tags that don’t need a closing tag. For example:img tag, hr tag, br tag, meta tag etc.Q.22.What is formatting in HTML?Ans. The HTML formatting is a process of format the text for a better look and feel. It uses different tags to make text bold, italicized, underlined.Q.23.How to create a hyperlink in HTML?Ans. The HTML provides an anchor tag to create a hyperlink that links one page to another page. These tags can appear in any of the following ways:
Unvisited link – It is displayed, underlined and blue.
Visited link – It is displayed, underlined and purple.
Active link – It is displayed, underlined and red.
Q.24.What are some common lists that are used when designing a page?Ans. 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

    1. tag.
    1. Unordered list – The unordered list displays elements in bulleted format. It is represented by

      • tag.
      • Definition list – The definition list displays elements in definition form like in dictionary. The
,

and
tags are used to define description list.

Q.25.What is a marquee?

Ans. 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 …… tag.

Q.26.How many tags can be used to separate a section of texts?

Ans. Three tags are used to separate the texts.

tag – Usually
tag is used to separate the line of text. It breaks the current line and conveys the flow to the next line

tag – The

tag contains the text in the form of a new paragraph.

tag – It is used to define a large quoted section. If you have a large quotation, then put the entire text within

………….

tag.

Q.27.What are empty elements?

Ans. HTML elements with no content are called empty elements. For example:
,


etc.

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

Ans. The span tag is used for following things:
For adding color on text
For adding background on text
Highlight any color text

Q.29.What is the use of an iframe tag?

Ans. An iframe is used to display a web page within a web page.

Q.30.What are the entities in HTML?

Ans. An HTML entity is a piece of text (“string”) that begins with an ampersand (&) and ends with a semicolon (;) . Entities are frequently used to display reserved characters (which would otherwise be interpreted as HTML code), and invisible characters (like non-breaking spaces)For example, the entity for the copyright symbol (©) is © “©”

Q.31.Why is a URL encoded in HTML?

Ans. An URL is encoded to convert non-ASCII characters into a format that can be used over the Internet because a URL is sent over the Internet by using the ASCII character-set only. If a URL contains characters outside the ASCII set, the URL has to be converted. The non-ASCII characters are replaced with a “%” followed by hexadecimal digits.

Q.32.Does a tag is a HTML tag?

Ans No, the 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, is used to instruct the web browser about the HTML page.