1. What is HTML?
HTML is the abbreviation for Hypertext Markup Language. It is the typical documents’ markup language for developing web pages to display on the web browser.

The extensions used to save HTML pages are .html and .htm.

HTML features- 

  • Documents contain HTML tags and plain text.
  • HTML documents are also called web pages.
  • The tags describe the document content.
  • Publish the documents with headings, texts, tables, etc.
  • Retrieve online information via hypertext links.
  • Design form to conduct transactions with remote services.
  • It can be easily understood and modified.
  • It has various formatting tags thus making it ideal for effective presentation.
  • Platform independent as it can be displayed on a platform like Windows, Linux, etc.
  • It is a case sensitive language making the tags usable for both lower-case and upper-case.

2. What is a Tag in HTML? Can you define HTML attributes?

In an HTML page, tags used are to place the content and format the pages. They always defined between (<) and (>) symbols. For example, <h1>text</h1>.

An opening tag must be preceded with a closing tag and indicated with a ‘/’ symbol.

A tag instructs the browser to format the HTML. Tags have many uses, such as changing the appearance of text, displaying a graphic, or linking another page. Coming to the other part of the question, HTML attributes are properties you can add to an HTML tag. Such attributes alter the way a tag behaves or the way it is displayed. For instance, <img> tag comes with an src attribute that you use for adding image sources. We can add attributes after the name of an HTML tag, within the brackets. Remember, we can add attributes to the opening and self-closing tag only.  No attributes are added to closing tags.

The HTML tags are keywords which are used in HTML that are used to display the web-pages. Theta re also used to define the HTML elements. Each HTML tag defines a new property that helps in the website rendering. Some of the HTML tags are mentioned below-

  • Head Tags
  • Link Tags
  • Scripting Tags
  • Table Tags
  • Text- formatting Tags
  • List Tags
  • Form Tags
  • Image and Object Tags

This makes for the html basic interview questions, make sure to prepare well for this question.

3. What is the key difference between HTML Elements and Tags? Also, Can you separate sections of texts in HTML?
This is one of the most asked HTML basic interview questions.

HTML Elements

The sections of the web page, such as a paragraph, an image, or a link is an element, and an element has a certain way of execution. For example, the link is used to be clicked, and the text boxes can be used to input text.

HTML Tags

HTML elements communicate with the browser how to represent the text and become HTML tags when enclosed within angular brackets <>.

As for the latter part of the question, here is the answer. Yes, you can separate section of texts in HTML with the following tags:

  • <p> tag–Use this tag for writing a paragraph of any text.
  • <br> tag – Use this for separating a line of text. This will break a current line and also shift the flow of a text over to new line.
  • <blockquote> tag–Use this tag to define any large quoted section.

It is one of the vey basic html interview questions, make sure to be well thorough with this topic.

4. If you want to display some HTML data in a table in tabular format, which HTML tags will you use?
The HTML has a specific tag, i.e., the table tag to display data in tabular form. Below is the list of the HTML tags used to display data in tabular form in HTML:

Tag

Description
<table>

For defining a table.
<caption>

For mentioning a caption to the table.
<tr>

For defining a row in a table.
<td>

For defining a cell in a table.
<th>

For defining a header cell in a table.
<tbody>

For grouping the body’s content in a table.
<col>

For specifying the column properties for each column of the table.

5. What are Attributes in HTML?
An additional attribute is given to each tag to alter the behavior of the tag. Attributes are defined directly after the tag name, inside the angular brackets. They appear in opening tags and can never appear in closing tags.

For example:

You can define an attribute for the <input> tag, such as a text field, checkbox, radio button, or many more ways.

The properties of tags are called as attributes. These are used to add certain additional information in a tag content. All HTML elements are said to be having the attributes.They are said to be always specified in the start tag.

Refer to the below mentioned table to learn about various HTML attributes-

Attributes Description 
src Specifies the URL (web address) for an image.
style Specifies the inline CSS style for an element.
alt Specifies an alternative style for an image.
disabled Specifies for an input element to be disabled.
href Specifies the URL (web adress) for a link.
title Specifies extra information about an element.

These types of questions can be asked during html interview questions for freshers so make sure to respond to these html questions by elaborating and structuring your answers.

6. What is an Anchor tag in HTML?
An anchor tag is used to link two sections, web pages, or website templates in HTML.

The anchor tags are web page elements that are used to link to nother location on the same page.  These are also used to hyperlinks to other webpages, emails, applications and items. These anchor tags also allow the users to send emails from their outlook installed on their computers.

Its format is:

<a href=”#” target=”link”></a>

Where ‘href’ is an attribute of the anchor tag used to identify the sections in a document, the ‘link’ is defined in the target attribute, which is to be linked.

The html interview questions and answers should be responded like this. Make sure to also mention the format of tags along with the descriptive answers.

7. What are Lists in HTML?
HTML lists are used to group a set of related items in lists. It is defined with an <li> tag.

Some commonly used HTML lists:

  • Ordered List (HTML tag: <ol>)
  • Unordered List (HTML tag: <ul>)
  • Description List (HTML tag: <dl>)
  • Menu List (HTML tag: <menu>)
  • Directory List (HTML tag: <dir>)

8. Define HTML Layout.
An HTML web page is arranged in a specific layout (format). Here are the sections of an HTML webpage to specify the different parts of a webpage:

The primary sections of the layout are:

  • Header to define a document or a section header.
  • Main content where the entire web page content is included.
  • Footer to define a document or a section footer.

There are also sections such as articles and the navigation bar that are the parts of a layout.

The HTML forms are a document that stores information of a user on a web server. The form contains various information, such as –

  • Username
  • Password
  • Contact Number
  • Email ID

There are also various input elements in the HTML forms. Some of the common input elements include-

  • Text field
  • Check box
  • Password field
  • Radio Button
  • Submit Button

9. What are Forms in HTML?
Forms are used to collect the user information when they are filled, and details are provided to save into the database. They serve as essential components of interactive web pages, offering users the scope of iterating with web applications and providing a means for the performance of various actions on the website and submission of data.

10. What is the Use of Comments in HTML?
Comments are used in an HTML document to make important notes and help developers mention any modification to be incorporated afterward. They are not displayed in the browser when the code is executed. A comment is always written in between the ‘—‘ symbol at the beginning and end of the angular brackets.

Syntax:

<!—‘Comment’ !–>

11. What is HTML5?

It has set forth the following new characteristics to be learned by professionals:

  • DOCTYPE declaration: To declare the HTML document type to instruct the web browser about the markup language.
  • Main: The main tag defines the primary section in the document related to the central content of a document with a <main> tag.
  • Section: It is used to define specific sections in a document such as a chapter, header, footer, or any other section, and is specified with the <section> tag.
  • Header: The header tag defines the title or heading of a document or its section. It is specified with the <header> tag.
  • Footer: The footer tag defines the section of a document that contains information such as copyright or author’s information. It is designated with the <footer> tag.
  • Article: The article tag represents an independent or self-contained part of the content of a document with the tag <article>.

Advantages of HTML 5-

  • Cleaner Markup/ Improved Code: It will enable the designers to use cleaner, neater code.
  • Elegant forms: It enables the designers to use the fancier forms.
  • Consistency: More consistency will be seen in terms of HTML to code a web page on one site.
  • Supports rich media elements: It has an inbuilt capacity to play audio and video to let go of plug-in tags.
  • Offline Application Cache: It will load the page the user has visited if the user is temporarily offline.

12. What is Semantic HTML?
Semantic HTML is one style of coding, where the tags convey the meaning of the text. Rather than the simple use of HTML elements for visual appearance, semantic HTML elements represent the structure and meaning of the content on a web page. HTML uses semantics to reinforce the semantics or purpose of the content.

Through the use of semantic HTML, search engines and web developers can ensure a better understanding of the content and its relevance. This often leads to improved search engine optimization, overall user experience as well as improved accessibility.

For Example:

<b> </b> and <i> </i> tags which are used to bold and italic statements in HTML are replaced with <strong></strong> and <em></em> tags in semantic HTML.

Uses of semantic HTML:

  • It helps the search engines to determine the importance and context of web pages.
  • It is much easier to read with semantic elements.
  • It has a greater accessibility.
  • They offer better user experience.

Refer to the below-metioned table for HTML Semantic elements-

Tags Elements
<aside> It defines some content aside from the content it is placed.
<nav> Defines a set of navigation links.
<article> Specifies the independent, self- contained content.
<section> Represents the section of a document.
<header> Represents a container for introductory content.
<footer> Represents a footer for the document.
<main> Specifies the main page.
<summary> Specifies the header for the <details> element.
<mark> Specifies the text that is highlighted.

Make sure to tackle these html questions and answers by mentioning the elements and advantages as well.

13. What is an Image Map?
An Image map lets you link different web pages with a single image. It is represented with the <map> tag. Every employer expects the applicant to know about this, and this has been one of the most commonly asked HTML interview questions.

14. Why is the Embed Tag Used in HTML?
An Embed Tag is used for including a Video or Audio in an HTML Document. A source of audio or video file to be displayed on the webpage is defined within an Embed tag as:

<EMBED> Source </EMBED>.

15. What is a ‘Marquee’ Tag in HTML?
You can put scrolling text with a Marquee tag. With the help of this tag, an image or text can be scrolled up, down, left, or right.

Properties of Marquee Tags in HTML:

  • It is used to create a scroll over the text.
  • It allows all types of scrolls like left to right, right to left, top to bottom and bottom to top.

Features of Marquee Tags in HTML:

  • Behaviour- It is the action of scrolling the text which can be one of the values.
  • Bgcolor- Gives background colour.
  • Direction- Sepcifies the direction of scrolling the text.
  • Height- Defines the height of marquee.
  • Hspace- Provides the horizontal space around the marquee element.
  • Loop- Defines how many times the text can be scrolled.
  • Scrollamount- Specifies the scrolling amount for each element.
  • Scrolldelay- Gives the scrolling delay in milliseconds.
  • Truespeed- Indicate the scrolldelay value of 60.
  • VSpace- Provides the vertical space around the marquee element.
  • Width- Defines the width for the marquee.

16) What is HTML?
HTML is short for HyperText Markup Language and is the language of the World Wide Web. It is the standard text formatting language used for creating and displaying pages on the Web. HTML documents are made up of two things: the content and the tags that format it for proper display on pages.

17) What are tags?
Content is placed in between HTML tags in order to properly format it. It makes use of the less than symbol (<) and the greater than symbol (>). A slash symbol is also used as a closing tag. For example:

<strong>sample</strong>

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

19) What are some of the common lists that can be used when designing a page?
You can insert any or a combination of the following list types:
– ordered list
– unordered list
– definition list
– menu list
– directory list
Each of this list types makes use of a different tag set to compose

20) How do you insert a comment in HTML?
Comments in HTML begins with “<!–“nd ends with “–>”. For example:

<!– A SAMPLE COMMENT –>

 
21) Do all character entities display properly on all systems?
No, there are some character entities that cannot be displayed when the operating system that the browser is running on does not support the characters. When that happens, these characters are displayed as boxes.

22) What is an image map?
Image map lets you link to many different web pages using a single image. You can define shapes in images that you want to make part of an image mapping.

23) What is the advantage of collapsing white space?
White spaces are a blank sequence of space characters, which is treated as a single space character in HTML. Because the browser collapses multiple spaces 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.

24) Can attribute values be set to anything or are there specific values that they accept?
Some attribute values can be set to only predefined values. Other attributes can accept any numerical value that represents the number of pixels for a size.

25) 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.

26) How do you create links to sections within the same page?
Links can be created using the <a> tag, with referencing through the use of the number (#) symbol. For example, you can have one line as <a href=”#topmost”>BACK TO TOP</a>, which would result in the words “BACK TO TOP” appearing on the webpage and links to a bookmark named topmost. You then create a separate tag command like <a name=”topmost”> somewhere on the top of the same webpage so that the user will be linked to that spot when he clicked on “BACK TO TOP”.

27) 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 subnested 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.

28) If you see a web address on a magazine, to which web page does it point?
Every web page on the web can have a separate web address. Most of these addresses are relative to the top-most web page. The published web address that appears within magazines typically points this top-most page. From this top level page, you can access all other pages within the website.

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

30) 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.

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

32) If the user’s operating system does not support the needed character, how can the symbol be represented?
In cases wherein their operating system does not support a particular character, it is still possible to display that character by showing it as an image instead.

33) 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.

34) 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 site.

35) State  bullet types available in HTML
With ordered lists, you can select to use some different list types including alphabetical and Roman numerals. The type attribute for unordered lists can be set to disc, square, or circle.

36) 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 color. You can use this tag combination as many times as needed, surrounding a single character or an entire word.

37) Why are there both numerical and named character entity values?
The numerical values are taken from the ASCII values for the various characters, but these can be difficult to remember. Because of this, named character entity values were created to make it easier for web page designers to use.

38) Write an HTML table tag sequence that outputs the following:
50 pcs 100 500
10 pcs 5 50

<table> <tr> <td>50 pcs</td> <td>100</td> <td>500</td> </tr> <tr> <td>10 pcs</td> <td>5</td> <td>50</td> </tr> </table>

39) What is the advantage of grouping several checkboxes together?
Although checkboxes don’t affect one another, grouping checkboxes together help to organize them. Checkbox buttons can have their name and do not need to belong to a group. A single web page can have many different groups of checkboxes.

40) 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 find this problem when the text does not display properly on the browser screen.

41) 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.

42) What if there is no text between the tags or if a text was omitted by mistake? Will it affect the display of the HTML file?
If there is no text between the tags, then there is nothing to format. Therefore no formatting will appear. Some tags, especially tags without a closing tag like the <img> tag, do not require any text between them.

43) Is it possible to set specific colors for table borders?
You can specify a border color using style sheets, but the colors for a table that does not use style sheets will be the same as the text color.

44) How do you create a link that will connect to another web page when clicked?
To create hyperlinks, or links that connect to another web page, use the href tag. The general format for this is: <a href=”site”>text</a>
Replace “site” with the actual page URL that is supposed to be linked to when the text is clicked.

45) What other ways can be used to align images and wrap text?
Tables can be used to position text and images. Another useful way to wrap text around an image is to use style sheets.

46) Can a single text link point to two different web pages?
No. The <a> tag can accept only a single href attribute, and it can point to only a single web page.

47) What is the difference between the directory and menu lists and the unordered list?
The key difference is that the directory and menu lists do not include attributes for changing the bullet style.

48) Can you change the color of bullets?
The bullet color is always the same as that of the first character in the list item. 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.

49) What are the limits of the text field size?
The default size for a text field is around 13 characters. However, 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.

50) Do <th> tags always need to come at the start of a row or column?
Any <tr> tag can be changed to a <th> tag. This causes the text contained within the <th> tag to 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.

51) 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.

52) 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.

53) How do you create text on a webpage that will allow you to send an email when clicked?
To change text into a clickable link to send email, use the mailto command within the href tag. The format is as follows:

<A HREF=”mailto:youremailaddress”>text to be clicked</A>

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

55) Are there instances where the text will appear outside of the browser?
By default, the text is wrapped to appear within the browser window. However, if the text is part of a table cell with a defined width, the text could extend beyond the browser window.

56) 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.

57) Do style sheets limit the number of new style definitions that can be included within the brackets?
Style sheets do not limit the number of style definitions that can be included within the brackets for a given selector. Every new style definition, however, must be separated from the others by a semicolon symbol.

58) Can I specify fractional weight values such as 670 or 973 for font weight?
Implementation largely depends on the browser, but the standard does not support fractional weight values. Acceptable values must end with two zeroes.

59) 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.

60) Can several selectors with class names be grouped together?
You can define several selectors with the same style definition by separating them with commas. This same technique also works for selectors with class names.

61) What happens if you open the external CSS file in a browser?
When 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.

62) How do you make a picture into a background image of a web page?
To do this, place a tag code after the </head> tag as follows:

<body background = “image.gif”>

Replace image.gif with the name of your image file. This will take the picture and make it the background image of your web page.

63) What happens if the list-style-type property is used on a non-list element like a paragraph?
If the list-style-type property is used on a non-list element like a paragraph, the property will be ignored and do not affect the paragraph.

64) 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.

65) What happens if the number of values in the rows or cols attribute doesn’t add up to 100 percent?
The browser sizes the frames relative to the total sum of the values. If the cols attribute is set to 100%, 200% the browser displays two vertical frames with the second being twice as big as the first.

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

67) 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.

68) Do you know which are two semantic tags are included in HTML5 version?
The <article> and <section> tags are two new tags that are included in HTML5. Articles can be composed of multiple sections that can have multiple articles. An article tag represents a full block of content which is a section of a bigger whole.

69) 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.

70) 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.

71) What are the new FORM elements which are available in HTML5?
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) <datalist> – This tag is use to specify a list of options for input controls.
2) <keygen> – This tag represents a key-pair generator field.
3) <output> – It represents the result of any scripting calculation.

72) Tell me two benefits of HTML5 Web Storage
Two main benefits of HTML5 Web Storage:

  • It can store up to 10 MB data which is certainly more than what cookies have.
  • Web storage data cannot be transferred with the HTTP request. It helps to increase the performance of the application.

73) What are two types of Web Storage in HTML5?
Two storage types of HTML5 are:

Session Storage: It stores data of current session only. It means that the data stored in session storage clear automatically when the browser is closed.

Local Storage: Local storage is another type of HTML5 Web Storage. In local storage, data is not deleted automatically when the current browser window is closed.

74) What is the Application Cache in HTML5 and why it is used?
The Application Cache concept means that a web application is cached. It can be accessible without the need for internet connection.

Some advantages of Application Cache:

  1. Offline browsing – Web users can also use the application when they are offline.
  2. Speed – Cached resources load quicker
  3. Reduce the server load – The web browser will only download updated resources from the server.

75) Explain five new input types provided by HTML5 for forms?
Following are the important, new data types offered by HTML5:

  1. Date: It allows the user to select a date.
  2. datetime-local: This input type allows the user to select a date and time without time zone.
  3. datetime: This input type allows the user to select a date and time with time zone.
  4. month: It enables the user to select a month and year
  5. email: These input fields used to contain an e-mail address.
Back to list

Leave a Reply

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