HTML 5 interview questions and answers
Question 1. What is HTML5?
Answer:- HTML stands for HyperText Markup Language. It is a language of the World Wide Web. It is a standard text formatting language that is used to create and display pages on the Web. It makes the text more interactive and dynamic. It can turn text into images, tables, links. More details.
Question 2. Name some of the new features of HTML5.
Answer:-HTML5 introduces a number of new elements and attributes that helps in building modern websites. Following are great features introduced in HTML5 −
- New Semantic Elements − These are like <header>, <footer>, and <section>.
- Forms 2.0 − Improvements to HTML web forms where new attributes have been introduced for <input> tag.
- Persistent Local Storage − To achieve without resorting to third-party plugins.
- WebSocket − A next-generation bidirectional communication technology for web applications.
- Server-Sent Events − HTML5 introduces events that flow from a web server to web browsers and they are called Server-Sent Events (SSE).
- Canvas − This supports a two-dimensional drawing surface that you can program with JavaScript.
- Audio & Video − You can embed audio or video on your web pages without resorting to third-party plugins.
- Geolocation − Now visitors can choose to share their physical location with your web application.
- Microdata − This lets you create your own vocabularies beyond HTML5 and extend your web pages with custom semantics.
- Drag and drop − Drag and drop the items from one location to another location on the same webpage.
Question 3. Which browsers support HTML5?
Answer:- The latest versions of Apple Safari, Google Chrome, Mozilla Firefox, and Opera all support many HTML5 features, and Internet Explorer 9.0 will also have support for some HTML5 functionality.
The mobile web browsers that come pre-installed on iPhones, iPads, and Android phones all have excellent support for HTML5.
Question 4. Is HTML5 backward compatible with old browsers?
Answer:- Yes! HTML5 is designed, as much as possible, to be backward compatible with existing web browsers. New features build on existing features and allow you to provide fallback content for older browsers.
It is suggested to detect support for individual HTML5 features using a few lines of JavaScript.
Question 5. Are HTML tags case sensitive?
Answer:- NO!
Question 6. What is the purpose of the ‘section’ tag in HTML5?
Answer:-This tag represents a generic document or application section. It can be used together with h1-h6 to indicate the document structure.
Question 7. What is the purpose of the ‘article’ tag in HTML5?
Answer:-This tag represents an independent piece of content of a document, such as a blog entry or newspaper article.
Question 8. What is the purpose of the ‘aside’ tag in HTML5?
Answer:-This tag represents a piece of content that is only slightly related to the rest of the page.
Question 9. What is the purpose of the ‘header’ tag in HTML5?
Answer:-This tag represents the header of a section.
Question 10. What is the purpose of the ‘footer’ tag in HTML5?
Answer:-This tag represents a footer for a section and can contain information about the author, copyright information, et cetera.
Question 11. What is the purpose of the ‘nav’ tag in HTML5?
Answer:-This tag represents a section of the document intended for navigation. More Details ..
Question 12. What are custom attributes in HTML5?
Answer:- A custom data attribute starts with data- and would be named based on your requirement. Following is a simple example−
1
2
3
<div class="example" data-subject="physics" data-level="complex">
...
</div>
The above will be perfectly valid HTML5 with two custom attributes called data-subject and data-level. You would be able to get the values of these attributes using JavaScript APIs or CSS in a similar way as you get for standard attributes.
Question 13. –What are some of the common lists that can be used when designing a page?
Answer:- You can insert any or a combination of the following list types:
– ordered list
– unordered list
– definition list
– menu list
– directory list
Each of these list types makes use of a different tag set to compose
Question 14. How do you insert a comment in HTML?
Answer:- Comments in HTML begin with “<!–“and ends with “–>”. For example:
1
<!-- A SAMPLE COMMENT SECTION-->
Question 15. How do you insert a copyright symbol on a browser page?
Answer:- To insert the copyright symbol, you need to type © or & #169; in an HTML file.
Question 16. How do you create links to sections on the same page?
Answer:- Links can be created using the <a> tag, with referencing through the use of the number (#) symbol. For example, you can have one line as <a href=”#topmost”>BACK TO TOP</a>, which would result in the words “BACK TO TOP” appearing on the webpage and links to a bookmark named topmost. You then create a separate tag command like <a name=” topmost”> somewhere on the top of the same webpage so that the user will be linked to that spot when he clicked on “BACK TO TOP”.
Question 17. What is a marquee?
Answer:- A marquee allows you to put scrolling text on a web page. To do this, place whatever text you want to appear scrolling within the <marquee> and </marquee> tags.
Question 18. Are <br> tags the only way to separate sections of text?
Answer:- No. The <br> tag is only one way to separate lines of text. Other tags, like the <p> tag and <blockquote> tag, also separate sections of text.
Question 19. What are two types of Web Storage in HTML5?
Answer:- Two storage types of HTML5 are:
Session Storage: Local Storage: It stores data of the current session only. It means that the data stored in session storage clears automatically when the browser is closed. Local storage is another type of HTML5 Web Storage. In local storage, data is not deleted automatically when the current browser window is closed.
Question 20. What is formatting in HTML?
Answer:- HTML formatting is a process of formatting the text for a better look and feel. It uses different tags to make text bold, italicized, underlined. More details.
Question 21. 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. More details.
Question 22. How many types of heading does 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 a different text size from another. So, <h1> is the largest heading tag and <h6> is the smallest one. For example:- More Details
Question 23. 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. More Details…
Question 24. What is an image map?
Answer:- 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 of an image mapping.
Question 25. 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.
Question 26. Explain the layout of HTML?
Answer:-
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>: It is used to define a header for a document or a section.
- <nav>: It is used to define a container for navigation links
- <section>: It is used to define a section in a document
- <article>: It is used to define an independent, self-contained article
- <aside>: It is used to define content aside from the content (like a sidebar)
- <footer>: It is used to define a footer for a document or a section
Question 27. How to make a picture of a background image of a web page?
Answer:- To make a picture a background image on a web page, you should put the following tag code after the </head> tag.
1<body background = "image.gif">
Here, replace the “image.gif” with the name of your image file which you want to display on your web page.
Question 28. What are empty elements?
Answer:- HTML elements with no content are called empty elements. For example: <br>, <hr> etc.
Question 29. What is the use of an iframe tag?
Answer:- An iframe is used to display a web page within a web page.
Syntax –
1<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>
Question 30. 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.
Question 31. 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>
Question 32. 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
Question 33. Which type of video formats are supported by HTML5?
Answer:-
HTML 5 supports three types of video format:
- mp4
- WebM
- Ogg More details..
Question 34. Is 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.
- mp3
- WAV
- Ogg
Let’s see the code to play an mp3 file using an 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. More Details Audio tag …
Question 35. 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.
Question 36. What is a button tag?
Answer:- The figure tag is used to add a photo in the document on the web page. It is used to handle the group of diagrams, photos, code listing with some embedded content.
<p>The Taj Mahal is widely recognized as "the jewel of Muslim art in India and one of the universally admired masterpieces of the world's heritage."</p>
<figure>
<img src="htmlpages/images/tajmahal.jpg" alt="Taj Mahal"/>
</figure>
Question 37. What is the use of details and summary tag?
Answer:- The details tag is used to specify some additional details on the web page. It can be viewed or hidden on demand. The summary tag is used with the details tag.
Question 38. What is the datalist tag? (40)
Answer:- The HTML 5 datalist tag provides an autocomplete feature on the form element. It facilitates users to choose the predefined options to the users to select data.
<label>
Enter your favorite cricket player: Press any character<br />
<input type="text" id="favCktPlayer" list="CktPlayers">
<datalist id="CktPlayers">
<option value="Sachin Tendulkar">
<option value="Brian Lara">
<option value="Jacques Kallis">
<option value="Ricky Ponting">
<option value="Rahul Dravid">
<option value="Shane Warne">
<option value="Rohit Sharma">
<option value="Donald Bradman">
<option value="Saurav Ganguly ">
<option value="AB diVilliers">
<option value="Mahendra Singh Dhoni">
<option value="Adam Gilchrist">
</datalist>
</label>
Question 39. What is the use of the required attribute in HTML5?
Answer:- It forces a user to fill text on the text field or text area before submitting the form. It is used for form validation.
Name: <input type="text" name="name" required>
Question 40. What are the drawbacks of cookies?
Answer:- Cookies have the following drawbacks−
- Cookies are included with every HTTP request, thereby slowing down your web application by transmitting the same data.
- Cookies are included with every HTTP request, thereby sending data unencrypted over the internet.
- Cookies are limited to about 4 KB of data. Not enough to store required data.
If you write your thoughts so write here — www. wearewriter.com
JOIN US ON SOCIAL MEDIA
Instagram-@coders_village