HTML Interview Questions

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 formats it for proper display on pages.[



What are tags?


For example: <strong><sample></strong>

Do all HTML tags come in pair?


Examples are : <img> tag and <br> tags.


– ordered list
– unordered list
– definition list
– menu list
– directory list

Do all character entities display properly on all systems?


What is image map?


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?


Get Started to become a hands-on expert on Python.

Join over 10000+ learners who have taken up Python training with Iteanz. Get Certification, Best Price and 24/7 Customer Care.

How do you create links to sections within the same page?


Is there any way to keep list elements straight 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.

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.



What are style sheets?


What bullet types are available?

With ordered lists, you can select to use a number of different list types including alphabetical and Roman numerals. The type attribute for unordered lists can be set to disc, square, or circle.

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 are applets?




Why are there both numerical and named character entity values?


What is the advantage of grouping several checkboxes together?

Although checkboxes don’t affect one another, grouping checkboxes together helps to organize them. Checkbox buttons can have their own name and do not need to belong to a group. A single web page can have many different groups of checkboxes.

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.


If there is no text between the tags, then there is nothing to format, so no formatting will appear. Some tags, especially tags without a closing tag like the <img> tag, do not require any text between them.

Is it possible to set specific colors for table borders?



Replace “site” with the actual page url that is supposed to be linked to when the text is clicked.



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



The key differences is that the directory and menu lists do not include attributes for changing the bullet style.

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.

Do tags always need to come at the start of a row or column?


What is the relationship between the border and rule attributes?


What is a marquee?


How do you create a text on a webpage that will allow you to send an email when clicked?

To change a text into a clickable link to send email, use the mailto command within the href tag. The format is as follows:

Are tags the only way to separate sections of text?


Are there instances where text will appear outside of the browser?


How are active links different from normal links?










Can several selectors with class names be grouped together?




Explore best ever Courses on Machine Learning

Change Your Career. Change Your Life. Now!





If the list-style-type property is used on a non-list element like a paragraph, the property will be ignored and have no effect on the paragraph.

When is it appropriate to use frames?



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.

Compare HTML & XML?

Criteria HTML XML
Deployed for Rendering things on screen Describing what things are
Functioning area Human to computer interaction Computer to computer interaction
Can explain what data means No Yes

What is $() in jQuery library?

The $() function is an alias of jQuery() function, at first it looks weird and makes jQuery code cryptic, but once you get used to it, you will love it’s brevity. $() function is used to wrap any object into jQuery object, which then allows you to call various method defined jQuery object. You can even pass a selector string to $()function, and it will return jQuery object containing an array of all matched DOM elements. I have seen this jQuery asked several times, despite it’s quite basic, it is used to differentiate between developer who knows jQuery or not.

What are the advantage of using jQuery?

  • Easy to use and learn.
  • Easily expandable.
  • Easy to use for DOM manipulation and traversal.
  • Large pool of built in methods.
  • AJAX Capabilities.
  • Methods for changing or applying CSS, creating animations.
  • Event detection and handling.
  • Tons of plug-ins for all kind of needs.

Difference between ID selector and class selector in jQuery?

If you have used CSS, then you might know the difference between ID and class selector, It’s same with jQuery. ID selector uses ID e.g. #element1 to select element, while class selector uses CSS class to select elements. When you just need to select only one element, use ID selector, while if you want to select a group of element, having same CSS class than use class selector. There is good chance that, Interview will ask you to write code using ID and class selector. From syntax perspective, as you can see, another difference between ID and class selector is that former uses “#” and later uses “.” character. More detailed analysis and discussion, see answer.

Difference between $(this) and this keyword in jQuery?

Could be a tricky questions for many jQuery beginners, but indeed it’s simplest one. $(this) returns a jQuery object, on which you can call several jQuery methods e.g. text() to retrieve text, val() to retrieve value etc, while this represent current element, and it’s one of the JavaScript keyword to denote current DOM element in a context. You can not call jQuery method on this, until it’s wrapped using $() function i.e. $(this).

What is main advantage of loading jQuery library using CDN?

This is slightly advanced jQuery question, and don’t expect that jQuery beginners can answer that. Well, apart from many advantages including reducing server bandwidth and faster download, one of the most important is that, if browser has already downloaded same jQuery version from same CDN, than it won’t download it again. Since now days, almost many public websites use jQuery for user interaction and animation, there is very good chance that browser already have jQuery library downloaded. Curious reader, please see the answer for in depth analysis.

How do CSS precedence/cascading rules work? How does the !important directive affect the rules?

CSS style rules “cascade” in the sense that they follow an order of precedence. Global style rules apply first to HTML elements, and local style rules override them. For example, a style defined in a style element in a webpage overrides a style defined in an external style sheet. Similarly, an inline style that is defined in an HTML element in the page overrides any styles that are defined for that same element elsewhere.The !important rule is a way to make your CSS cascade but also have the rules you feel are most crucial always be applied. A rule that has the !important property will always be applied no matter where that rule appears in the CSS document. So if you wanted to make sure that a property always applied, you would add the !important property to the tag. So, to make the paragraph text always red, in the above example, you would write:p { color: #ff0000 !important; }p { color: #000000; }

What is a class? What is an ID?

The following snippet shows a class defined, and then it being applied to an HTML DIV element.
.test {font-family: Helvetica; font-size: 20; background: black;}


Also, you could define a style for all elements with a defined class. This is demonstrated with the following code that selects all P elements with the column class specified.
p.column {font-color: black;}
The following snippet shows the CSS example1 defined followed by the use of an HTML element’s ID attribute, which pairs it with the CSS selector.
#example1: {background: blue;}

What is Grouping?

When more than one selector shares the same declaration, they may be grouped together via a comma-separated list; this allows you to reduce the size of the CSS (every bit and byte is important) and makes it more readable. The following snippet applies the same background to the first three heading elements.h1, h2, h3 {background: red;}

What is “Semantic HTML?