32 Best HTML Interview Questions & Answers

32 Best HTML Interview Questions & Answers

If you are looking forward to dive into web development as a lead or as a fresher, make sure to maintain the required skill set. To rule the world of web development, the most basic skill required for designing is HTML. HTML is short for HyperText Markup Language.  Developers use this language to make their web pages more presentable and appealing. HTML professionals use their skills to create text, paragraphs, define structures, styles etc.

You’re going to attend an HTML interview and you’re worried about how the interview questions would be and what interviewees would expect from you. Here are some quick answers to your questions along with some important interview questions and answers.

What is HTML?

HTML is an acronym for HyperText Markup Language. It is a programming language designed to make web pages more interactive, dynamic and presentable. Programmers can design tables, images, links etc., in web pages. An HTML document is made of HTML tags. Each tag contains different content.

What is the relationship between SGML, HTML, XML and XHTML?

SGML is a standard used to specify how to specify document markup. It is the base for all markup languages. HTML is designed using SGML.  To make parsing easier XML is created based on SGML which supports automatic closing of end tags.

What are tags?

A tag is a word enclosed between less than “<” and greater than “>” symbols which describe the style of the content. All the content of the web page is placed between HTML tags. Tags exist in pairs mostly. A closing tag has a slash within the symbols.

How to insert a copyrights symbol on the web pages?

The copyrights symbol can be inserted using “&copy” or “&#169” in a web page.

What is the difference between HTML elements and tags?

HTML elements act as a communication medium to the browser. They are used to render text from browsers. The elements when enclosed between brackets “<>” are called tags.

Does hyperlink apply to images?

Yes, hyperlinks can be applied to images along with texts. Even an image can be made clickable with the ability to take visitor to the next page. Making image clickable is similar to that of text. It can be made using <a href> tag.

What is the advantage of using frames?

Frames make it easier to navigate through a site. It also makes it easier to organize the page and make links available throughout the site.

Is it possible to hide HTML source?

No, it is not possible to hide the source from being visible as a browser requires it to display the document.

Explain cell-padding and cell-spacing?

Cell-padding and cell-spacing are the table contents that help to adjust the space between the cells of the table. Cell-padding is the gap or the space between the cell content and cell border or cell wall. Cell-spacing refers to the gap between the two cells of same table.

What is the difference between HTML and XHTML?

  1. HTML is used to create static web pages whereas XHTML is used for dynamic web page development.
  2. The programmer can make changes for HTML tags whereas for XHTML tags are not changeable and programmer needs to create new tags.

How many types of CSS can be included in HTML?

There are three ways to include CSS with HTML. They are:

  1. Inline CSS: To style only smaller amounts of contents programmers choose Inline CSS. Inline CSS is added in the relevant tag to style the contents.
  2. External Style Sheets: When a programmer needs to style a set of documents, then external style sheet is the best option. Style sheet is written as a separate file and all the documents that are needed to be styled must contain link to the style sheet using <link> tag. This <link> tag is written in head section.
  3. Internal Style sheet: When only a single document needs to be styled then the internal style sheet is used. It is written in the head section of the document using <style> tag.

What are logical and physical tags in HTML?

Logical tags are used to explain the meaning of the enclosed text. Example of the logical tags are <strong>, <bold>, <italics> etc., When these tags are used, the browser gets to know that the enclosed text is different from other text and applies the styles accordingly.

Does HTML support JavaScript?

Yes, HTML pages support JavaScripts. It can be inserted anywhere in the page. In general, it is inserted in four areas: Head Section, Body section, Both Head and Body, External file.

What is the use of Marquee tag?

When a programmer wants to make the text move either vertically or horizontally in the webpage like a scrolling, marquee tag is used.

What is HTML5?

HTML5 is the newer version of the HTML and is standard for structuring and presenting content of the web pages.

List some new features of HTML5?

HTML5 contains some of the new attractive features added to it. They are:

  1. Semantic elements: <header>, <footer>, <section> tags are introduced for presenting more effective page formatting styles in an effective manner.
  2. Forms 2.0: <input> tag is added to the HTML web forms which makes easier to read input to forms.
  3. Canvas: Using this, a two-dimensional drawing space is supported and it can be programmed using JavaScript.
  4. Drag and Drop: This new version supports drag and drop feature. It allows programmer to drag and drop elements from one location to another on a single page.
  5. Audio and Video: Using HTML5, programmer can embed audio and video files into web page.
  6. Micro data: This feature lets programmers create their own vocabularies and extend web pages with custom semantics.

What are new media elements in HTML5?

  1. <audio> tag: This tag is used to insert and play audio clips in the page.
  2. <video> tag: This tag is used to play and insert videos into HTML page.
  3. <source> tag: This is used to mention media resources for media elements.
  4. <embed> tag: It is used to mention embed elements.
  5. <track> tag: It is used for text tracks in media players.

What is CSS?

CSS stands for Cascading Style Sheets. CSS plays an important role in website building. It gives web site developer and user more control over the web pages in terms of its styling.

How to change the number type in the middle of the list?

The number type of the lists can be changed using the attribute of the <li> tag. It has two values type and value.

What are the types of bullets available in HTML?

Bullets can be numbered or symbols. They vary from alphabetical to roman numerals in numbered format and in symbols it can be disc, circle, or square.

What is the advantage of grouping several checkboxes together?

Grouping of checkboxes helps in better organization of the web page. A single web page can contain multiple groups of checkboxes.

Can a single text link point to two different web pages?

the <a> tag can accept only a single href attribute; hence it can point to only single page at a time.

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 render fasts.

What are selectors in CSS?

Selectors are useful for selecting an element that is to be styled. For example below is a simple style.

background-color: red;
To apply this style,
<div class=”div”>
<p>this is an example</p>

What is the use of the column layout of CSS?

CSS column layout helps you to divide your text in to columns. To implement column layout we need to specify the number of columns required using column-count attribute.

What is the local storage concept in HTML5?

Most of the times, users like to store the information locally and restore it later when the internet connection works. For this purpose HTML5 support the concept of local storage. A modern browser allows the users to store the information locally on the computers they are using. This comes handy when users are working with long forms with an unstable internet connection.

What is the lifetime of local storage?

The information stored on the local storage will not get removed by itself. It has to remove from the browser by user or the programmer with the help of JavaScript. Hence, it doesn’t have any lifetime.

What is the difference between cookies and local storage?

These two differ from each other in three aspects- Client/server side,      size, and expiration. Data stored in cookies is available for both client and server side can access with every request made where as local storage is available only for client side and it request a put or get request to access data from server side. Cookies can hold up to 4095 bytes where as local storage can store up to 5MB per domain.  Cookies are similar to temporary storage and are attached with expiration time. Hence after specified time data gets deleted automatically. On the other hand, local storage has to expiration and data is deleted only when user attempts to do so or the programmer runs a JavaScript code to delete the data.

Is WebSQL a part of HTML5?

Even though many people label it as HTML5 specification, WebSQL is not a HTML5 specification. It is based around SQLLite.

What is session storage in HTML5?

Session storage is used to store the data for that particular session i.e., the data is available for the all the pages of site opened in that single page. Once the window is closed the data stored during the session is lost. Such storage is called session storage.

What is Server-Side Events in HTML5?

Along with HTML5, WHATWG Web Applications 1.0 introduces events which flow from web server to the web browsers and they are called Server-Sent Events (SSE). Using SSE you can push DOM events continuously from your web server to the visitor’s browser. The event streaming approach opens a persistent connection to the server, sending data to the client when new information is available, eliminating the need for continuous polling. Server-sent events standardize how we stream data from the server to the client.

What is the Geolocation API in HTML?

HTML5 Geolocation API lets you share your location with your favorite web sites. A Javascript can capture your latitude and longitude and can be sent to backend web server and do fancy location-aware things like finding local businesses or showing your location on a map.

Today most of the browsers and mobile devices support Geolocation API. The geolocation APIs work with a new property of the global navigator object ie. Geolocation object which can be created as follows:

var geolocation = navigator.geolocation;

The geolocation object is a service object that allows widgets to retrieve information about the geographic location of the device.

What are Web workers?

Web Workers do all the computationally expensive tasks without interrupting the user interface and typically run on separate threads. Web Workers allow for long-running scripts that are not interrupted by scripts that respond to clicks or other user interactions, and allows long tasks to be executed without yielding to keep the page responsive.

What are web sockets?

Web Sockets is a next-generation bidirectional communication technology for web applications which operates over a single socket and is exposed via a JavaScript interface in HTML 5 compliant browsers. Following is the API which creates a new WebSocket object.

var Socket = new WebSocket(url, [protocal] );

Leave a Reply

Close Menu