Top 20 HTML Interview Questions and Answers

I am going to share basic HTML Interview Questions with Answers. It's really helpful for HTML fresher and HTML experienced candidate for getting the right HTML job.

Top 20 HTML Interview Questions and Answers


How can I hide of my source?

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

Are <br> tags the only way to the separate sections of text?

No. The <br> tag is only one of the way to separate lines of the text. Other tags, like the <p> tag and <blockquote> tag, also to separate sections of the text.

Do <th> tags always to need to come at the start of an row or column?

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

Do you know which are the two semantic tags are included in HTML5 version?

The <article> and <section> tags are the two new tags that are included in HTML5. Articles can be composed to multiple sections that can have multiple articles. An article tag of represents a full block of the content which is a section of the bigger whole.

Does HTML support to the Javascript?

Yes, HTML supports the  JavaScripts. We can use of the JavaScript anywhere in the HTML Coding. Mainly there are the four sections where we can add to JavaScript in HTML.

How do I create a link that opens to the new window?

<a target=”_blank” href=…> opens an new, unnamed windows.

<a target=”example” href=…> opens a new window named “example”, provided to that a window or frame by that name does not already can be exist.

Note that the TARGET attribute is not part of the  HTML 4 Strict. In HTML 4 Strict, new windows can be created only with the JavaScript. links that open new windows can be annoying to your readers if there is not the good reason for them.

How do I let people download an file from my page?

Once the file is uploaded to server, you need only for use an anchor reference tag to link to it. An example would be:

<a href=”../files/foo.zip”>Download Foo Now! (100kb ZIP)</a>

How do I set the focus to first form on field?

You cannot do this with of  HTML. However, you can include an script after the form that sets of  the focus to the appropriate field of  like this:

<form id=”myform” name=”myform” action=…>

<input type=”text” id=”myinput” name=”myinput” …>

</form>

How do you make a picture into the background image of a web page?

To do this, place a tag code after the </head> tag as follows:

<body background = “image.gif”>

How will you align a table to the right or left?

  • To align a table to the right, you can use <TABLE ALIGN=”right”>
  • To align a table to the left, you can use <TABLE ALIGN=”left”>

Is it possible to the list elements straight in an HTML file?

– Yes, it is possible with the use of the indents.

Name two new tags included to the HTML 5

<Video> and <Audio> are new tags which are included to HTML5 version. They are mainly used to a replacement for Flash, Silverlight, and similar technologies to the play multimedia items.

What are the limits of text field size?

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

What does the DOCTYPE mean?

The term DOCTYPE means Document Type of Definition and tells them browser which type of HTML is used on the webpage. Browsers use DOCTYPE to determine how to render pages. Failing to use of  DOCTYPE will load your page in the Quirks Mode.

What is the CORS? How does it work?

Cross-origin resource of sharing (CORS) is a mechanism that allows many of restricted resources (e.g. fonts, js etc.) on web pages to be requested from another domain outside the domain from which the resource an originated. It’s the mechanism supported in the HTML5 that manages XMLHttpRequest access to the domain different.

What is the difference between the HTML elements and tags?

HTML elements communicate to the browser how to render of text. When surrounded by angular brackets <> they form HTML tags, which can come in the pairs and a surround text.

What is the main function of the <pre> tag in HTML?

<pre> tag defines is the pre-formatted text that is used to the display the text with the fixed width and uses a predefined the fonts and it keeps both spaces and line breaks in separate and shows the text as it is.

What is the purpose of the canvas in HTML?

Canvas is on the element that is used for the graphics for the web pages. It uses JavaScript to bring the graphics functionality to live. It allows to an easy way to the draw the graphics and uses to different types of tools to create the drawing on the web pages. Canvas is just a rectangular area that control to the pixel of every to an element that is used in the web pages. Canvas uses methods like paths, circles, etc.

What is the syntax difference between bulleted and numbered list?

Bulleted lists use of  the <ul> tag, which stands for “unordered,” whereas <ol> is used to the create the ordered lists.

Which browsers support to HTML5?

The latest versions of the Google Chrome, Apple Safari, Mozilla Firefox, and Opera all support to most of the HTML5 features.

Comments