Top 10 HTML Interview Questions And Answers
What is HTML?
- Html stands for Hypertext markup language
- HTML is the language of the World Wide Web and is used to create a website.
- HTML defines the structure of the webpage using markup.
- The elements in HTML are represented by tags.
- HTML documents are made up of two things: Tags and content
What are Tags in HTML?
- Contents are placed between HTML tags to format it.
- HTML tags comes in pairs like <tag_name> amd </tag_name> (Eg. <p>This is a paragraph</p>).
- The first tag in a pair is the start tag (or opening tag) and the last tag in a pair is the last tag (or closing tab).
Is there any pair that does not come in pairs?
- Yes. There are some tags that do not come in pairs. Examples include <img> tag and <b> tag.
What are HTML Documents?
- All HTML pages are starting with a document type declaration (<!DOCTYPE html>).
- The HTML document itself begins with <html> and </html>
- The visible part of the body will be inside <body> and </body>
How to insert a comment in HTML?
- <!-- This is a comment -->
How do we set style in HTML Tag?
- The style in the HTML tag can be done using the style tag.
- <name_of_the_tag style style="property:value;"></name_of_the_tag>
What are the different formatting of HTML Text?
- HTML uses elements like <strong>,<b>,<i> to format text.
- Formatting is used to display different styles of text.
- <b> - This is Bold text
- <i> - This is italic text
- <em> This is Emphasized text
- <mark> - This is marked text
- <strong> - This is an important text
- <del> This is deleted text
- <sub> This is subscript text
- <sup> This is superscript text
- <ins> This is inserted text
What is the purpose of <br> tag?
- <br> tag is used to separate lines of text and also to separate sections of text.
Is there any other tag to separate sections of text other than <br>?
- Yes. <p> tag and <blockquote> can be used to separate sections of text.
What are the different types of lists in HTML?
- Ordered list
- Unordered list
- Description Lists
- Nested HTML Lists
- Directory List
- Menu List
Can a hyperlink apply only to text only?
- No. Hyperlinks can apply to images too as well as text.