Top 8 HTML interview questions & answers
#1 What is HTML?
HTML stands for Hyper Text Markup Language and is the standard language for creating websites. The latest version is known as HTML5.
#2 What is formatting in HTML?
HTML Formatting is a process of formatting text for better look and feel. HTML provides us the ability to format text without using CSS. There are many formatting tags in HTML. These tags are used to make text bold, italicized, or underlined.
#3 What are tags?
HTML tags are like keywords that tell the browser how to display certain things.
The structure is following:
1) Opening tag: states where the element begins
2) The content: this is everything that goes into the element
3) Closing tag: states where the element ends
#4 Does all tags have to be closed?
No, there are some tags like the <image> or the <br> tag that don’t require a closing tag.
#5 How many types of heading does HTML contain?
There are six types of headings which are defined as <h1>, <h2>, <h3>, <h4>, <h5> and <h6>.
Each type has a different text size with <h1> being the biggest one.
#6 How to create a hyperlink in HTML?
For creating a hyperlink you can use the <a> tag. The href attribute is the link destination. You can also add the target attribute and define if a link should open in a new window.
#7 What is the difference between HTML elements and tags?
Tags are the starting and ending parts of an HTML element. They begin with < symbol and end with > symbol.
Elements are the content between the tags.
#8 What are some common lists that are used?
<ol> is an ordered list and displays elements in numbered format.
<ul> is an unordered list and displays elements with bullet points.
<dl>, <dt>, <dd> tags are used to define definition lists and they display elements in definition form like in a dictionary.