HTML Questions
Warm up for HTML questions with most asked questions and answers for junior, mid, and senior roles.
What is HTML?
Show AnswerHide Answer
HTML is a markup language used to create web pages.
What are Tags?
Show AnswerHide Answer
Tags are used to create HTML elements.
How many types of heading does an HTML contain?
Show AnswerHide Answer
There are 6 types of headings in HTML:
How to create a hyperlink in HTML?
Show AnswerHide Answer
To create a hyperlink in HTML, you need to use the tag.
Is audio tag supported in HTML 5?
Show AnswerHide Answer
Yes, audio tag is supported in HTML 5.
You can use it using the tag.
What is button tag?
Show AnswerHide Answer
The button tag is used to create a button.
What is datalist tag?
Show AnswerHide Answer
The datalist tag is used to create a drop-down list.
What are Attributes and how do you use them?
Show AnswerHide Answer
Attributes are used to add extra information to HTML elements.
For example:
What is the purpose of using alternative texts in images?
Show AnswerHide Answer
Alternative texts are used to provide a text description of an image.
How are active links different from normal links?
Show AnswerHide Answer
Active links are links that are highlighted when the user clicks on them.
Normal links are links that are not highlighted when the user clicks on them.
What is the advantage of grouping several checkboxes together?
Show AnswerHide Answer
Grouping several checkboxes together is used to make it easier to select multiple checkboxes.
What happens if there is no text between the tags? Does this affect the display of the HTML file?
Show AnswerHide Answer
If there is no text between the tags, the HTML file will not display.
What is the ‘class’ attribute in HTML?
Show AnswerHide Answer
The class attribute is used to set the style of an element.
What is the use of an iframe tag?
Show AnswerHide Answer
What are the entities in HTML?
Show AnswerHide Answer
An HTML entity is a piece of text ("string") that begins with an ampersand (&) and ends with a semicolon (;).
Entities are frequently used to display reserved characters (which would otherwise be interpreted as HTML code), and invisible characters (like non-breaking spaces).
You can also use them in place of other characters that are difficult to type with a standard keyboard.
What is the canvas element in HTML5?
Show AnswerHide Answer
The canvas element is used to draw graphics, images, and other visual elements on the web page.
Do all HTML tags have an end tag?
Show AnswerHide Answer
No, in HTML5 there are 14 tags without ending tag for example:
Which type of video formats are supported by HTML5?
Show AnswerHide Answer
HTML5 supports the following video formats:
- mp4
- WebM
- Ogg
What are the limits of the text field size?
Show AnswerHide Answer
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.
What is the relationship between the border and rule attributes?
Show AnswerHide Answer
The border attribute is used to set the width of the border.
The rule attribute is used to set the style of the border.
What is Cell Spacing and Cell Padding?
Show AnswerHide Answer
Cell spacing is used to set the space between cells.
Cell padding is used to set the space between the cell content and the cell border.
How many types of CSS can be included in HTML?
Show AnswerHide Answer
There are two types of CSS: inline and external.
What are some common lists that are used when designing a page?
Show AnswerHide Answer
There are 3 types of lists in HTML:
What is the difference between HTML elements and tags?
Show AnswerHide Answer
HTML elements are the actual pieces of content that are displayed on the web page.
Tags are used to create HTML elements.
Difference between link tag <link> and anchor tag <a>?
Show AnswerHide Answer
The link tag is used to link to an external file.
The anchor tag is used to link to a page within the same HTML document.
In how many ways can we position an HTML element?
Show AnswerHide Answer
There are four ways to position an HTML element.
1. Absolute Positioning
2. Relative Positioning
3. Fixed Positioning
4. Static Positioning
In HTML, does a hyperlink only apply to text?
Show AnswerHide Answer
No, a hyperlink applies to both text and images.
Explain the layout of HTML?
Show AnswerHide Answer
The layout of an HTML file is the way the content is displayed on the web page, it is a blueprint used to arrange web pages in a well-defined manner.
When are comments used in HTML?
Show AnswerHide Answer
Comments are used to add extra information to HTML elements.
You can use it using the tag.
What is a style sheet?
Show AnswerHide Answer
A style sheet is a file that contains CSS or other form of styling code.
What is a marquee?
Show AnswerHide Answer
An HTML marquee is a scrolling piece of text displayed either horizontally across or vertically down your webpage depending on the settings.
What is the difference between div and span in HTML?
Show AnswerHide Answer
Why is a URL encoded in HTML?
Show AnswerHide Answer
URL is encoded into a format that can be transmitted over the Internet.
What are empty elements?
Show AnswerHide Answer
Empty elements are elements that have no content.
For example:
What is the use of a span tag?
Show AnswerHide Answer
tag is used as a generic container of inline elements. It is used for styling purpose to the grouped inline elements (using class and id attribute or inline style).
What is SVG?
Show AnswerHide Answer
SVG is a language for describing scalable vector graphics.
In how many ways you can display HTML elements?
Show AnswerHide Answer
There are four ways to display an HTML element.
1. Block
2. Inline
3. List
4. Table
What are logical and physical tags in HTML?
Show AnswerHide Answer
Physical Tags are used to indicate that how specific characters are to be formatted or indicated using HTML tags.
Logical tags are also known as structural tags that describe the behavior, nature of the content for the enclosed text.
What is difference between HTML and XHTML?
Show AnswerHide Answer
HTML is the standard markup language for creating web pages.
XHTML is a family of XML languages which extend or mirror versions of HTML.
It does not allow omission of any tags or use of attribute minimization. XHTML requires that there be an end tag to every start tag and all nested tags must be closed in the right order.
What are void elements in HTML?
Show AnswerHide Answer
A void element cannot have any content but may have attributes. Void elements are self-closing, so they must not have a closing tag.
What is the advantage of collapsing white space?
Show AnswerHide Answer
Collapsing white space is used to reduce the size of the web page.
When is it appropriate to use frames?
Show AnswerHide Answer
When you want to display multiple web pages on the same page.
What is an image map?
Show AnswerHide Answer
tag defines an imagep map. An image map is a collection of areas on an image, that are clickable and link to a page.What is semantic HTML?
Show AnswerHide Answer
Semantic HTML is a way to make the content of a web page more readable.
For example:
How do you keep list elements straight in an HTML file?
Show AnswerHide Answer
You can keep the list elements straight by using indents in an HTML file.
How many tags can be used to separate a section of texts?
Show AnswerHide Answer
There are 3 types of tags that can be used to separate a section of texts:
Can you create a multi-colored text on a web page?
Show AnswerHide Answer
…
tags for every character that you want to apply color.