All HTML interview questions
- What is HTML?
Html is short for Hypertext Markup Language, and is the language of the World Wide Web. It’s the standard text formatting language used for creating and displaying pages on the web.
- What are tags?
Content is placed in between HTML tags in order to properly format it. HTML tags are composed of three things: opening tag, content and ending tag. Some tags are unclosed tags
Ex: <html> Content here</html>, <br/>
- What is the difference between HTML elements and tags?
Html elements are used to render text in the browser. Tags are those which is inside <> bracket.
- What are the lists in HTML?
- Order list
- Unordered list
- Menu list
- Directory list
- Definition list
- How do you insert a comment in HTML?
<! — Your comment is here –>
- How to insert symbol in HTML file?
We can insert symbols by inserting the number or entity of the symbol. Example: for inserting Copy right symbol we need to write © or ©
- What are bullet types available in HTML?
The type attribute for unordered lists can be set to disc, square, circle or any symbol.
- What is applet?
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.
- With HTML starting and ending tag is the body part render?
Yes! Without the <html></html> the body render.
- How do you create a link that will connect to another web page when clicked?
By anchor tag <a href=”target address”>your link name</a>
Example: <a href=http://www.google.com>Google</a>
- 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.
- 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 do you create a text on a webpage that will allow you to send an email when clicked?
<a href=mailto:your mail address>mail me</a>
- How are active links different from normal links?
The default color for normal and active links is blue. Some browsers recognise an active link when the mouse cursor is placed over that link; others recognise 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 are empty elements?
HTML elements with no content are called empty elements. For example: <br>, <hr> etc.
- What is Canvas in HTML5?
- What is the new form element in HTML5?
Following is a list of 10 important new elements in HTML 5:
- Which Video format support in HTML?
HTML 5 supports three types of video format:
- What is the difference between progress and meter tag?
HTML <progress> tag is used to display the progress of a task. It provides an easy way for web developers to create progress bar on the website. It is mostly used to show the progress of a file uploading on the web page.
The <meter> tag defines a scalar measurement within a known range, or a fractional value. This is also known as a gauge. Examples: Disk usage, the relevance of a query result, etc.
- What is the use of <figure> tag in HTML5?
It’s used to add photo in the document.
- If I don’t put <! DOCTYPE HTML> will HTML5 work?
No, browser will not be able to identify that it is a HTML document and HTML 5 tags will not function properly.
- What is the user of required attribute in HTML5?
It forces user to fill text on textfield or textarea before submitting form. It is used for form validation.
- Why we use alt text?
If the browse not loading the element or not support the element it display the alt text.
- How many heading tags in HTML?
There are six heading tags in HTML they are <h1> to <h6>
- What is HTML attributes?
It provides additional information about the elements.
- What is lang attribute in <html>?
Declaring a language is important for accessibility applications (screen readers) and search engines.
- What is the difference between title tag and attribute?
<Title> tag display the text on the top of the browser tab and the title attribute will be displayed as a tool tip when you mouse over the element.
- What is the user of <pre>?
The text inside a <pre> element is displayed in a fixed-width font (usually Courier), and it preserves both spaces and line breaks.
- What are the HTML formatting elements?
- <b> – Bold text
- <strong> – Important text
- <i> – Italic text
- <em> – Emphasised text
- <mark> – Marked text
- <small> – Small text
- <del> – Deleted text
- <ins> – Inserted text
- <sub> – Subscript text
- <sup> – Superscript text
- What is the use of <iframe>?
An iframe is used to display a web page within a web page.
- What is the user of <Meta>?
The <meta> element is used to specify page description, keywords, author, and other metadata. Metadata is used by browsers (how to display content), by search engines (keywords), and other web services.
- How to add styles into HTML element?
Write the style code inside the <style>.
- What is the difference between div and span tags in html?
The difference between span and div is that a span element is in-line and usually used for a small chunk of HTML inside a line (such as inside a paragraph) where as a div (division) element is block-line (which is basically equivalent to having a line-break before and after it) and used to group larger chunks of code.
- What id DOM?
The Document Object Model (DOM) is a programming API for HTML and XML documents. It defines the logical structure of documents and the way a document is accessed and manipulated.
- What is event in HTML?
37. What are the new HTML elements in HTML5?
|<article>||Defines an article in the document|
|<aside>||Defines content aside from the page content|
|<bdi>||Defines a part of text that might be formatted in a different direction from other text|
|<details>||Defines additional details that the user can view or hide|
|<dialog>||Defines a dialog box or window|
|<figcaption>||Defines a caption for a <figure> element|
|<figure>||Defines self-contained content, like illustrations, diagrams, photos, code listings, etc.|
|<footer>||Defines a footer for the document or a section|
|<header>||Defines a header for the document or a section|
|<main>||Defines the main content of a document|
|<mark>||Defines marked or highlighted text|
|<menuitem>||Defines a command/menu item that the user can invoke from a popup menu|
|<meter>||Defines a scalar measurement within a known range (a gauge)|
|<nav>||Defines navigation links in the document|
|<progress>||Defines the progress of a task|
|<rp>||Defines what to show in browsers that do not support ruby annotations|
|<rt>||Defines an explanation/pronunciation of characters (for East Asian typography)|
|<ruby>||Defines a ruby annotation (for East Asian typography)|
|<section>||Defines a section in the document|
|<summary>||Defines a visible heading for a <details> element|
|<time>||Defines a date/time|
|<wbr>||Defines a possible line-break|