HTML Interview Questions

1) What is HTML?

HTML is short form of HyperText Markup Language, and is the language of the World Wide Web. Without HTML WWW cant’t exist. HTML is a text formatting language used for creating and displaying web pages. HTML documents are made up of two things: the tags and the content that formats it for exact to display on pages.

2) What are tags?

HTML tags and conents are used to display a proper format of HTML webpages. It makes use of the (<) less than symbol and the (>) greater than symbol . A forward slash is also used as a closing tag.

3) All HTML tags come in pair or not?

No, HTML tags also contains single tags that does not need to closing tag. For Example: <img> tag and <br> tags.

4)What are common lists used in HTML?

Different types of lists are as follows:

  • ordered list
  • unordered list
  • definition list
  • menu list
  • directory list

5)How commen is used in html?

Comments in html starts with “<!–“ and ends with “–>”.
You can use this comment for multiline, conditional or single line also.

6)All character entities display properly on Different OS?

No, there are some character entities cannot be displayed the operating system the browser is running on does not support the characters. so, these characters are displayed as boxes.

7)What is image map?

You can use different shapes of single image for  image mapping. Image map is used to link many different web pages using a single image.

8)What is the use of collapsing white space?

This enables you to organize the html code into a much more readable format. Because the browser collapses multiple space into a single space, you can indent lines of text without worrying about multiple spaces. White spaces are blank sequence of space characters, which is actually treated as a single space character in html.

9)Can attribute values be set to anything or specific values that they accept?

Any numerical value that represents the number of pixels for a size all that should accept attributes. Some attribute values can be set to only predefined values.

10)How do you insert a copyright symbol on a browser page?

&copy; or & #169; by using this you can insert the copyright symbol, you need to type in an HTML file.

11)can I hide my source?

No. you can’t hide your source because it is required by the browser to display your document.

12)How will you align a table right or left?

To align the table to the right, <TABLE ALIGN=”right”>

and to the left, you can use <TABLE ALIGN=”left”>.

13)What is the use of <dl> tag in HTML?

The <dl> is a definition list tag used in HTML. It contains the <dt> and <dd>. <dt> is used to list the item while <dd> is used to describes it.

14)What is the advantage of frames in HTML?

The links that appear within the frame can appear through out the site. Frames make it easier to navigate through a site.

15)What is a marquee?

Marquee is used for the scrolling text on a web page. You should put the text within<marquee>……</marquee> tag which you want to scroll.

16)Which browsers support HTML 5?

Almost all browsers i.e. Safari, Chrome, Firefox, Opera, Internet Explorer support HTML 5.

17)What is the lifetime of local storage?

Local storage does not have a life time.  They stay until either the user clear it from the browser or you remove it using JavaScript code.

18)Why <th> tags used at the start of a row or column?

Any <tr> tag can be changed to a <th> tag. The text contained within the <th> tag will be displayed as bold in the browser. Although <th> tags are mainly used for headings, they do not need to be used exclusively for headings.

19)What is the default size of the text field?

The default size for a text field is upto 13 characters, but if you include the size attribute, you can set the size value to be as low as 1. The maximum size value can be determined by the browser width. If the size attribute is set to 0, the size will be set to the default size of 13 characters.

20)What are empty HTML elements?

HTML elements with no content are called empty elements.

21)What is the difference between HTML and XHTML?

The differences between HTML and XHTML are as follows:

HTML is application of Standard Generalized Markup Language(SGML) XML is application of Extensible Markup Language(XML).
HTML is a static Web Page HTML is dynamic Web Page.
HTML allows programmer to perform changes in the tags and use attribute minimization XHTML when user need a new markup tag then user can define it in this.
HTML is about displaying information XHTML is about describing the information.

22)Explain Cell Spacing and Cell Padding.

Cell Spacing : It refers to the gap between the two cells of same tables.
Cell Padding : It refers to the gap or space between the cell content and cell border or cell wall.

In HTML cell spacing and padding both are used with Table Border layout.

23)What are logical and physical tags in HTML?

Logical tags Physical tags
Logical tags are used to tell the meaning of the enclosed text. Physical tags are used to tell the browser that how to display the text enclosed in the physical tag.
The example of the logical tag is <strong> </strong> tag. If we enclose some text in strong tag then it tell the browser that enclosed text is more important than other text. The example of the physical tags are: <b>, <big>, <i>

24)What is the use of DIV in HTML?

The DIV specifies the default horizontal alignment for the contents of this element.It is required for compatibility with deployed browsers and can be overriden by style sheets. The Default alignment is at LEFT.

25)What is the use of caption in HTML?

It specifies a caption for a table. This element is valid within the table element. For the caption end tag is required.

26)What is the use of <a> tag?

<a> stands for anchor. It requires end tag. It contains destination address or destination file. It is in URL format. If no path specified, the file stay in same location which is current page.

27)What is the use of  style sheet?

A style sheet is used to build a consistent, transportable, and well designed style template. You can use these templates on several different web pages.

28)Is it possible to create a multi colored text on a web page?

Yes. It is possible to create a multicolor text on a web page you can use <font color =”colorname”> </font> for the specific texts you want to color.

29)Is it possible to change the color of the bullet in HTML?

Yes, it is possible to change the color of the bullet but color of the bullet is depends on the color of the first text of the list. So, if you want to change the color of the bullet, you must change the color of the text.

30)How many tags are used to separate section of texts?

Three tags used to separate the texts. <br> tag ,<p> tag and <blockquote> tag.

31)How to set a image as background image of a web page?

To set image a background image on a web page, you can use the <body background = “image.jpg”>.

32)What are empty elements?

br>, <hr>  used as a empty elements. The HTML elements with no content are called empty elements.

33)What is the span tag? 

The span tag is used for following things:

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

34)What are the different tpyes of form element types in HTML 5?

Following is a list new form  elements in HTML 5:

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

35)Is there any need to change the web browsers to support HTML5?

No. Almost all browsers with updated versions support HTML 5. e.g.Chrome, Firefox, Opera, Safari, IE etc.

36)How many video formats are supported by HTML5?

HTML 5 supports three types of video format such as follows:

  • mp4
  • webm
  • ogg

37)Is audio tag supported in HTML 5?

Yes, audio tag is supported to the HTML 5. It is used to add sound or music files on the web page.

38)If I do not put <!DOCTYPE html> will HTML 5 work?

No, the browser will not be able to identify that it is a HTML document and HTML 5 tags without <!doctype html>will not function properly.

39)What is the use of required attribute in HTML5?

It forces user to fill text on textfield or textarea before submitting form. It is used for form validation.

40)What are the new <input> types for form validation in HTML5?

The new input types for form validation are email, url, number, tel and date.

41)Does a hyperlink only apply to text?

No, you can use hyperlinks on text and images both.

42)How do you keep list elements straight in an HTML file?

You can keep the list elements straight by using indents.





Leave a Reply

Your email address will not be published. Required fields are marked *