HTML Interview Questions and Answers For Freshers
A list of top frequently asked HTML interview questions and answers and HTML5 interview questions and answers are given below.
#1 What is HTML?
Answer: HTML stands for HyperText Markup Language. It is the language of the World Wide Web. It is a standard text formatting language that is used to create and display pages on the Web. HTML makes the text more interactive and dynamic. It can turn text into images, tables, links. HTML pages are saved by adding .html or .html in web page name.
#2 How are tags migrated from HTML4 to HTML5?
Answer :
No. | Typical HTML4 | Typical HTML5 |
1) | <div id=”header”> | <header> |
2) | <div id=”menu”> | <nav> |
3) | <div id=”content”> | <section> |
4) | <div id=”post”> | <article> |
5) | <div id=”footer”> | <footer> |
#3 What is the difference between progress and meter tag?
Answer: The progress tag is used to represent the progress of the task only while the meter tag is used to measure data within a given range.
#4 Is an audio tag supported in HTML 5?
Answer: Yes. It is used to add sound or music files on the web page. There are three supported file formats for HTML 5 audio tag. This is an Important HTML Interview Questions and Answers
- mp3
- WAV
- Ogg
Let’s see the code to play the mp3 file using the HTML audio tag.
- <audio controls>
- <source src=”koyal.mp3″ type=”audio/MPEG”>
- Your browser does not support the HTML audio tag.
- </audio>
Instead of koyal.mp3, you can pass any mp3 file name.
#5 Which type of video formats are supported by HTML5?
Answer: HTML 5 supports three types of video format:
- mp4
- WebM
- Ogg
#6 What are the different new form element types in HTML 5?
Answer: Following is a list of 10 frequently used new elements in HTML 5:
- Color
- Date
- Datetime-local
- Time
- Url
- Range
- Telephone
- Number
- Search
#7 What is SVG?
Answer : HTML SVG is used to describe the two-dimensional vector and vector/raster graphics. SVG images and their behaviors are defined in XML text files. So as XML files, you can create and edit an SVG image with the text editor. It is mostly used for vector type diagrams like pie charts, 2-Dimensional graphs in an X, Y coordinate system.
- <svg width=”100″ height=”100″>
- <circle cx=”50″ cy=”50″ r=”40″ stroke=”yellow” stroke-width=”4″ fill=”red” />
- </svg>
#8 What is the canvas element in HTML5?
Answer: The <canvas> element is a container that is used to draw graphics on the web page using a scripting language like JavaScript. It allows for dynamic and scriptable rendering of 2D shapes and bitmap images. There are several methods in canvas to draw paths, boxes, circles, text, and add images. For Example:
- <canvas id=”myCanvas1″ width=”300″ height=”100″ style=”border:2px solid;”>
- Your browser does not support the HTML5 canvas tag.
- </canvas>
#9 What is the use of a span tag? Give one example.
Answer : The span tag is used for following things:
- For adding color on text
- For adding background on text
- Highlight any color text
Example:
- <p>
- <span style=”color:#ffffff;”>
- In this page we use span.
- </span>
- </p>
#10 What is the use of an iframe tag?
Answer : An iframe is used to display a web page within a web page.
Syntax:
- <iframe src=”URL”></iframe>
Example:
- <iframe src=”demo_iframe.html” width=”200px” height=”200px”></iframe>
Target to a link:
- <iframe src=”http://www.javatpoint.com” name=”iframe_a”></iframe>
#11 What are the entities in HTML?
Answer: The HTML character entities are used as a replacement for reserved characters in HTML. You can also replace characters that are not present on your keyboard with entities. These characters are replaced because some characters are reserved in HTML. This is an Important HTML Interview Questions and Answers
#12 Why is a URL encoded in HTML?
Answer: An URL is encoded to convert non-ASCII characters into a format that can be used over the Internet because a URL is sent over the Internet by using the ASCII character-set only. If a URL contains characters outside the ASCII set, the URL has to be converted. The non-ASCII characters are replaced with a “%” followed by hexadecimal digits. This is an Important HTML Interview Questions and Answers
#13 Does a <!DOCTYPE html> tag is a HTML tag?
Answer : No, the <!DOCTYPE html> declaration is not an HTML tag. There are many type of HTML e.g. HTML 4.01 Strict, HTML 4.01 Transitional, HTML 4.01 Frameset, XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1 etc. So, <!DOCTYPE html> is used to instruct the web browser about the HTML page.
#14 What is a marquee?
Answer: Marquee is used to put the scrolling text on a web page. It scrolls the image or text up, down, left, or right automatically. You should put the text which you want to scroll within the <marquee>……</marquee> tag.
#15 How many tags can be used to separate a section of texts?
Answer: Three tags are used to separate the texts.
- <br> tag – Usually <br> tag is used to separate the line of text. It breaks the current line and conveys the flow to the next line
- <p> tag – The <p> tag contains the text in the form of a new paragraph.
- <blockquote> – It is used to define a large quoted section. If you have a large quotation, then put the entire text within <blockquote>………….</blockquote> tag.
#16 Explain the layout of HTML?
Answer: HTML layout specifies a way in which the web page is arranged.
Every website has a specific layout to display content in a specific manner.
Following are different HTML5 elements that are used to define the different parts of a webpage.
- <header>: header is used to define a header for a document or a section.
- <nav>: nav is used to define a container for navigation links
- <section>: section is used to define a section in a document
- <article>: the article is used to define an independent, self-contained article
- <aside>: aside is used to define content aside from the content (like a sidebar)
- <footer>: footer is used to define a footer for a document or a section
#17 Does a hyperlink only apply to text?
Answer: No, you can use hyperlinks on text and images. The HTML anchor tag defines a hyperlink that links one page to another page. The “href” attribute is the most important attribute of the HTML anchor tag.
Syntax
- <a href = “………..”> Link Text </a>
#18 What is semantic HTML?
Answer : Semantic HTML is a coding style. It is the use of HTML markup to reinforce the semantics or meaning of the content. For example: In semantic HTML <b> </b> tag is not used for bold statement as well as <i> </i> tag is used for italic. Instead of these we use <strong></strong> and <em></em> tags.
#19 What is an image map?
Answer: An image map facilitates you to link many different web pages using a single image. It is represented by <map> tag. You can define shapes in images that you want to take part in an image mapping.
#20 What are some common lists that are used when designing a page?
Answer: There are many common lists that are used to design a page. You can choose any or a combination of the following list types:
- Ordered list – The ordered list displays elements in a numbered format. It is represented by <ol> tag.
- Unordered list – The unordered list displays elements in a bulleted format. It is represented by <ul> tag.
- Definition list – The definition list displays elements in definition form like in dictionary. The <dl>, <dt> and <dd> tags are used to define description list.
#21 What is the difference between HTML elements and tags?
Answer: HTML elements communicate to the browser to render text. When the elements are enclosed by brackets <>, they form HTML tags. Most of the time, tags come in a pair and surround content.
#22 How to create a hyperlink in HTML?
Answer: The HTML provides an anchor tag to create a hyperlink that links one page to another page. These tags can appear in any of the following ways:
- Unvisited link – It is displayed, underlined, and blue.
- Visited link – It is displayed, underlined, and purple.
- Active link – It is displayed, underlined, and red.
#23 Do all HTML tags have an end tag?
Answer : No. There are some HTML tags that don’t need a closing tag. For example: <image> tag, <br> tag.
#24 What is formatting in HTML?
Answer: The HTML formatting is a process of format the text for a better look and feel. It uses different tags to make text bold, italicized, underlined.
#26 How many types of heading do an HTML contain?
Answer : The HTML contains six types of headings which are defined with the <h1> to <h6> tags. Each type of heading tag displays different text size from another. So, <h1> is the largest heading tag and <h6> is the smallest one. For example:
- <h1>Heading no. 1</h1>
- <h2>Heading no. 2</h2>
- <h3>Heading no. 3</h3>
- <h4>Heading no. 4</h4>
- <h5>Heading no. 5</h5>
- <h6>Heading no. 6</h6>
#27 What is the difference between HTML elements and tags?
Elements | Tags |
The element is an individual component of the HTML web page or document. It represents semantics or meaning. For example, the title element represents the title of the document. | It is the root of the HTML document which is used to specify that the document is HTML. For example, the Head tag is used to contain all the head element in the HTML file. |
#28 When are comments used in HTML?
Answer: To understand the code easily, you can add code comments to your HTML document. These are not displayed in the browser, but they help you in leaving notes for yourself and other developers as to what a section of HTML is for. The start of the comment is denoted by <!– and the end is marked by — >. Anything in the middle will be completely ignored, even if it contains valid HTML.
For example:
1 2 3 |
<!-- This is a comment! -->
<!-- Comments can span multiple lines too -->
<!-- This part is ignored in the browser -->
|
#29 What is semantic HTML?
Answer: Semantic HTML is a coding style. It is the use of HTML markup to reinforce the semantics or meaning of the content. For example: In semantic HTML <b> </b> tag is not used for bold statement as well as <i> </i> tag is used for italic. Instead of these we use <strong></strong> and <em></em> tags.
Join Telegram Group of Daily Jobs Updates for 2010-2023 Batch: Click Here
If You Want To Get More Daily Such Jobs Updates, Career Advice Then Join the Telegram Group From Above Link And Never Miss Update.
Wipro Elite NLTH 2021 Registration has been Started: Click here
Accenture Hiring Freshers of Package 4.5 LPA Across India: Click here
Why You’re Not Getting Response From Recruiter?: Click here
Top 5 High Salary Jobs in India IT Sector 2020: Click here
How To Get a Job Easily: Professional Advice For Job Seekers: Click here
A Leadership Guide For How To Win Hearts and Minds: Click here
COVID-19 Live Tracker India & Coronavirus Live Update: Click here
Career Tips for Freshers: Top 7 Hacks To Land Your Target Job: Click here
Top 5 Best Indian Car Launches In December ahead: Click here
Feel Like Demotivated? Check Out our Motivation For You: Click here
Top 5 Best Mobile Tracking App in 2021 For Mobile & PC: Click here
5 Proven Tips For How To Look Beautiful and Attractive: Click here
Home Workouts During The Lockdown For Fitness Freaks: Click here
PUBG will be soon launched Registered as an Indian Company: Click here