HTML Interview Questions - A list of top frequently asked HTML interview questions and answers are given below. Front End Developer Interview Questions.
What is HTML?
HTML stands for Hypertext Markup Language. It is s markup language for World Wide Web. HTML was developed by Tim Berners Lee during 1990’s. It consists of tags which are used to define content and web page formatting.

What is DOCTYPE?
DOCTYPE stands for Document Type Declarations. DOCTYPE is used to specify the web browsers that which types of documents (such as SGML or XML Documents) it will receive. <!DOCTYPE> is declared above the <html> tag.

What are the different versions of HTML?
HTML has many versions since it inceptions during 1990’s. HTML version are HTML, HTML+, HTML 2.0, HTML 3.2, HTML 4.0 and the latest version HTML 5.
What are HTML Tags?
HTML tags similar to keywords which has specifies function, for example, for paragraph we can use HTML tag(<p>). HTML tags mostly comes in pair like, <p>, </p>.

Do all HTML tags come in pair?
No, there are single HTML tags that does not need a closing tag.
Examples are the <img> tag and <br> tags.

What is HTML Element?
An HTML element is everything from starting to the ending of HTML tags. For example, <p> This is an HTML Element</p>, in this example, from starting tag to ending tag everything is HTML element and “This is an HTML Element” is Element Content.

How do you insert a comment in html?
Comments in html begins with “<!–“and ends with “–>”.
For example: <!-- A SAMPLE COMMENT -->

What is HTML Attribute?
HTML attribute adds additional information to the HTML Elements.
For example, <font size=”5” color=”green”>, here size and color are html attributes.

What is Hyperlinks?
Hyperlinks are used to navigate to new document with the help of text, image or with group of words.

Does a hyperlink apply to text only?
No, hyperlinks can be used on text as well as images. That means you can convert an image into a link that will allow user to link to another page when clicked. Just surround the image within the <a href=” “>…</a> tag combinations.

Names some of the Web Browsers?
Some of the most famous web browsers are Google Chrome, Mozilla Firefox, Opera Browser, Safari and Netscape etc.

What is WWW?
WWW stands for World Wide Web. It is the inter-connection of all the links called as internet.

Which is the basic editor for HTML?
There are many editors for HTML like Notepad, Notepad++, EditPlus and WYSIWYG HTML editors etc.

What are the extension supported by HTML?
HTML supports both .htm and .html extension.

What are the web standards?
Web standards are standards specified for the internet or World Wide Web aspects for improving internet usability by all major OS and browsers.

What is semantic HTML?
Semantic HTML is a coding style. It is the use of HTML markup to reinforce the semantics or meaning of the content. For example: In semantic HTML <b> </b> tag is not used for bold statement as well as <i> </i> tag is used for italic. Instead of these we use <strong></strong> and <em></em> tags.

What is the HTML tag for Break?
HTML tag for break is <br>. The HTML break tag is used to insert a line break.

How to create Tables using HTML?
HTML tables are created using tags <table>. To divide a HTML table, we have to use <tr>, which is table row. Likewise, we <td> and <th>.

What are the tags use for Image?
HTML tag for images is <img>. We need to specify the image name and file location like <img src=”freshersemploy.png” alt=”Freshers Employ”>.

How to change font size?
HTML webpage font size can be varied according to the usage. HTML tag for changing the size of the font is <font size=”4”>.

How to open a link in new tab or window?
To open a link in new tab or window, we have to use the following html code:
<a href=”” target=”_blank”>Welcome to InterviewGIG</a>

What are the different types of Headings supported by HTML?
HTML headings are important to highlight the contents of the documents. HTML supports 6 heading starting from <h1> to <h6>.

What are the types of HTML lists?
There are two types of HTML list, they are ordered list and unordered list.

Is there any way to keep list elements straight in an html file?
By using indents, you can keep the list elements straight. If you indent each sub nested list in further than the parent list that contains it, you can at a glance determine the various lists and the elements that it contains.

Explain HTML blocks?
HTML blocks can be defined by HTML tags like <span> and <div>.

What is the difference between <div> and <span> elements?
<div> tags are used to define section in document block wise whereas <span> tag is used to define section in documents inline.

How to create frames?
HTML frames can be created by using <frame> tag within a frameset(<frameset>). HTML <frame> tag defines a particular window within frameset.

What is the difference between get and post method?
HTML methods sends request using get an post method. GET post request data from the server and POST is used to submit data to the server.

What is iframes? Why is recommended to avoid iframes?
<Iframe> tags are used to embedded documents within current HTML document.
HTML 5 does not support <iframe> any more. So it is recommend not ti use iframe in HTML any more.

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

How do you insert a copyright symbol on a browser page?
To insert the copyright symbol, you need to type &copy; or & #169; in an HTML file.

What is the use of using alternative text in image mapping?
When you use image maps, it can easily become confusing and difficult to determine which hotspots corresponds with which links. Using alternative text lets you put a descriptive text on each hotspot link.

Do older html files work on newer browsers?
Yes, older html files are compliant to the HTML standard. Most older files work on the newer browsers, though some features may not work.

How do you change the number type in the middle of a list?
The <li> tag includes two attributes – type and value. The type attribute can be used to change the numbering type for any list item. The value attribute can change the number index.

What are style sheets?
Style sheets enable you to build consistent, transportable, and well-defined style templates. These templates can be linked to several different web pages, making it easy to maintain and change the look and feel of all the web pages within a site.

How do you create multicolored text in a webpage?
To create text with different colors, use the <font color=”color”>…</font> tags for every character that you want to apply a color. You can use this tag combination as many times as needed, surrounding a single character or an entire word.

What will happen if you overlap sets of tags?
If two sets of html tags are overlapped, only the first tag will be recognized. You will recognize this problem when the text does not display properly on the browser screen.

What are applets?
Applets are small programs that can be embedded within web pages to perform some specific functionality, such as computations, animations, and information processing. Applets are written using the Java language.

Can you change the color of bullets?
The bullet color is always the same as that of the first character in the list litem. If you surround the <li> and the first character with a set of <font> tags with the color attribute set, the bullet color and the first character will be a different color from the text.

What are the limits of the text field size?
The default size for a text field is around 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 will 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.

What is the relationship between the border and rule attributes?
Default cell borders, with a thickness of 1 pixel, are automatically added between cells if the border attribute is set to a nonzero value. Likewise, If the border attribute is not included, a default 1-pixel border appears if the rules attribute is added to the <table> tag.

What is a marquee?
A marquee allows you to put a scrolling text in a web page. To do this, place whatever text you want to appear scrolling within the <marquee> and </marquee> tags.

How are active links different from normal links?
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.

What is the hierarchy that is being followed when it comes to style sheets?
If a single selector includes three different style definitions, the definition that is closest to the actual tag takes precedence. Inline style takes priority over embedded style sheets, which takes priority over external style sheets.

What happens if you open the external CSS file in a browser?
If you try to open the external CSS file in a browser, the browser cannot open the file, because the file has a different extension. The only way to use an external CSS file is to reference it using <link/> tag within another html document.

When is it appropriate to use frames?
Frames can make navigating a site much easier. If the main links to the site are located in a frame that appears at the top or along the edge of the browser, the content for those links can be displayed in the remainder of the browser window.

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

Name two new tags included in the HTML 5
<Video> and <audio> are new tags which are included in HTML5 version. They are mainly used as a replacement for Flash, Silverlight, and similar technologies to play multimedia items.

What is <figure> in HTML5?
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.

What is the use of Canvas element?
The canvas element helps to build charts, graphs, bypass Photoshop to create 2D images and place them directly into HTML5 code.

How to make a picture a background image of a web page?
To make a picture a background image on a web page, you should put the following tag code after the </head> tag.
<body background = "image.gif">
Here, replace the "image.gif" with the name of your image file which you want to display on your web page.

What is SVG?
SVG stands for scalable vector graphics. It’s a text based graphic language which draws images using text, lines, dots etc. This makes it lightweight and renders faster.

Which video formats are supported by HTML5?
HTML 5 supports three types of video format:
  • mp4
  • webm
  • ogg
How to use javascript in HTML?
By adding script tag in HTML like below –
<script type=”text/javascript”>
Alert(‘your message to display’);

What are the improvements done for Flash in HTML5?
In devices like iPad, iPhone etc. there is no support for Flash so it is a major problem as we can not install flash plugins in these devices so since HTML5 is universally accepted it has elements or tags which will behave in the same way as in Flash.

Explain caching in HTML5 and HTML?
Application Cache has been introduced in HTML5. It creates offline version of a webpage and stores the details such as Images, CSS, Javascript locally.

List out the new form attributes in HTML5?
Below are the new form attributes in HTML5 –
  • AutoComplete
  • NoValidate
Explain “NoValidate” attribute of HTML5?
“NoValidate” attribute is a Boolean attribute and this attribute signifies form data should be validated or not when submitted.

Explain “AutoComplete” attribute of HTML5?
“AutoComplete” attribute is used to signify the autocomplete feature should be present or not in the form elements. When it is “ON” then browser will fill the values, which is filled by the earlier users.

What are the different new form element types in HTML 5?
Below are the list of new input elements –
  • datetime
  • datalist
  • range
  • time
  • week
  • url
  • email etc.
List out new APIs introduced in HTML5?
Below are the list of APIs introduced in HTML5 –
  • Text track API
  • Media API
  • App Cache API
  • Data Transfer API
  • Validation API
  • History API
List out the new input attributes in HTML5?
Below are the new input attributes in HTML5 –
  • AutoFocus
  • Form
  • FormMethod
  • FormNoValidate
  • Height and Width
  • Min and Max
  • Placeholder
  • Required
What is WebSQL?
WebSQL is a structured relational database at the client browser side. It’s a local RDBMS inside the browser on which you can fire SQL queries.

Is WebSQL a part of HTML 5 specification?
No, many people label it as HTML 5 but it’s not part of HTML 5 specification. The specification is based around SQLite.

What is the purpose of 'section' tag in HTML5?
This tag represents a generic document or application section. It can be used together with h1-h6 to indicate the document structure.

What is the purpose of 'article' tag in HTML5?
This tag represents an independent piece of content of a document, such as a blog entry or newspaper article.

What is the purpose of 'aside' tag in HTML5?
This tag represents a piece of content that is only slightly related to the rest of the page.

What do you mean by session storage in HTML5?
HTML5 introduces the sessionStorage attribute which would be used by the sites to add data to the session storage, and it will be accessible to any page from the same site opened in that window i.e. session and as soon as you close the window, session would be lost.
Request to Download PDF

Post A Comment: