HTML Interview Questions and Answers

1. What is HTML?
Ans: HTML stands for Hyper Text Markup Language. It is a language of World Wide Web. It is a standard text formating 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. (html interview questions)

2. What do you know about HTML5?
Ans: Throughout the history of the internet, there have been many versions of the HTML standard. The versions showed in features and how strict they were. In 2014, the official recommendation for HTML5 by the World is released Wide Web Consortium. It is a living standard, and meaning new features can be added over time

3.  Name the New Form Elements Made Available In HTML5?
Ans: When we want to require some data from the person visiting our site, we use HTML Forms. An example is, the user has to enter his name, email id when he registers for the first time.
A form takes input from the site visitor and posts it to a back-end application such as CGI script, ASP Script or PHP script. The back-end application perform required processing on the passed data based and on defined business logic inside to the application.
There are various form elements available in earlier version of HTML like, text fields, text area fields, drop-down menus, radio buttons, checkboxes, etc

4. What are the list types available in HTML?
Ans: The common types of lists are available in HTML are given below.
1. Ordered list
2.  Unordered list
3.  Definition list
4.  Menu list
5. Directory list

5. What is hierarchy being followed when it comes to style sheets?
Ans: If a single selector consists three different style definitions, the definition which is closest to the actual tag takes precedence. Inline style takes priority over embedded style sheets, that takes priority over external style sheets.

6. What is an image map in HTML ?
Ans: Image mapping is a user to link from one image to different web pages in and it is out of the website. It is the process of knowing special shapes inside an image and link it to different destinations.

7.  How do we get the geographic position of a user in HTML5?
Ans: By using Geolocation API we can retrieve the location of the user.

8. What is “Semantic HTML?”
Ans: Semantic HTML is a coding style where the tags embody and what the text is meant to convey. In Semantic HTML, tags like for bold, and for italic should not be used, the reason becomes that they just represent formatting, and provide no indication of meaning or structure. The semantically correct thing to do is used and These tags will have the same bold and italic effects, while having demonstrating meaning and structure.

9. Write the role of physical tag and logical tag in HTML?
Ans: A Physical tag contains physical text that is used to tell the browser and how to display the text enclosed in the physical tag.

Logical tags are used to explain the meaning of the enclosed text in it. When we enclose text in the Important tag then it can explain the browser that the enclosed text is very important than other text.

10.  What does DOCTYPE mean?
Ans: Document Type Declaration is a type of instruction that usually works in association with particular SGML or XML documents basically. now an example to understand it more thoroughly, for example, A Web page with a document type definition i.e. DTD is the best to understand. In a well serialized and a proper form of the document, It manifests and also the contribution of having a short string of markup that usually conforms to a particular syntax.

11. Difference between $(this) and this keyword in jQuery?
Ans: It would be be a tricky questions for many jQuery beginners, but indeed it’s simplest one. $(this) returns a jQuery object, on that you can call several jQuery methods e.g. text() to retrieve text, val() to retrieve value etc, while this shows current element, and it’s one of the JavaScript keyword to denote current DOM element in a context. You can’t call to jQuery method on this, until it’s wrapped using $() function i.e. $(this).

12. What is meant by Anchor tag and how can you open an URL into a new tab when clicked?
Ans: In HTML Anchor Tag is used for linking between the two sections or two different web pages or website templates.

To open an url into a new tab in the browser upon a click, we want to add target attribute equal to _blank.

13. What Is The use Of Introducing Local Storage In HTML5?
Ans: Before HTML5, LocalStores was done with Cookies. They are not very good for large amounts of data, because, with every request, it passes this data to the server, making it very slow and ineffective. HTML5 does not pass this data on all server request. It uses the data ONLY when required. In HTML5, it is possible to store large amounts of data without affecting the website’s performance. Data for different website gets and stored in separate areas. However, a particular website can only having its own data.

14. What the Difference between ID selector and class selector in jQuery?
Ans: If you want to used CSS, then you might know the difference between ID and class selector, It’s same with jQuery. ID selector uses ID e.g. #element1 to select element, while class selector uses CSS class to select elements. When you just need to select one element, use ID selector, even if you want to select a group of element, having same CSS class than use class selector. There is chance that, Interview will ask you to write code using ID and class selector. From syntax perspective, as you can see, the another variation between ID and class selector is that former uses “#” and later uses “.” character.

15. What are the entities in HTML?
Ans: The HTML entities character are used as a replacement for reserved characters in HTML. You can also replace the characters that are not present on your keyboard by entities. These characters are replaced because of some characters are reserved in HTML.

16. Who is the author of HTML?
Ans: Sir Tim Berners-Lee, he is a great physicist who have a great personality is the author of HTML. He is also the director of the World Wide Web Consortium i.e. W3C. He is also the founder of World wide Web Foundation. Open Data Institute is founded by him and also he is director of this institute.H e is a director of the Web Science Research Initiative i.e. WSRI and he is the member of the advisory board of the MIT Center for Collective Intelligence. Sir Tim Berners have a great personality, as he is the professor of the computer department and also the founder of many institutes and Research initiatives. An idea struck into his mind, how can a computer be helpful for using and sharing documents. So, he designed the most trending and tremendous language, through which it is very easy to make web pages and all. Also, it is most trending and still in user like other outdated languages.

17. What new features were added to HTML5?
Ans: HTML5 introduced a number of semantic elements, which is to say about elements that convey meaning. Some of the new semantic elements are

They are semantic and that they are not simple containers, but they tell the browser more about their contents.
There are additional form of element types. i.e, like “number”, “date”, “calendar” and “range”. Video and audio elements are also added, as well as new graphic elements.

18. What is Group?
Ans: grouping means when more than one selector shares the same declaration, they may contain group together via a comma-separated list; this allows you to increase the size of the CSS (every bit and byte is important) and becomes it more to read.

19.  What is the use of a span tag?.
Ans: The span tag is used for following things.

1. For adding color on text
2. For adding background on text
3. Highlight any color text.

20. What is SVG?
Ans: HTML SVG is to explain the two-dimensional vector and vector/raster graphics. in XML text files we can seen SVG images and their behavior.you can create and edit an SVG image with the text editor as XML files. SVG is mostly used for vector diagrams like pie charts, 2-Dimensional graphs in an X, Y coordinate system.

21. Is any need to change the web browsers to support HTML5?
Ans: No. Almost all browsers means updated versions suppoArt HTML 5. For example Chrome, Firefox, Opera, Safar.

22. What is button tag?
Ans: The button tag is used in HTML 5. It is used to propose a clickAable button within the HTML form on the web page. and It is generally used to create a “submit” or “reset” button. Let’s see the code to display the button.

23. Define Semantic elements in HTML?
Ans: Semantic elements are the HTML elements that represent its meaning to the browser and developer about its contents.For Example: p tag shows a paragraph, a tag represents anchor tag, form tag, table tag, article tag and many more are semantic elements in HTML. Whereas div tag, span tag and bold tag are also not semantic elements.

24. What Is A Semantic Element In HTML5? Also, Explain The Difference Between Semantic And Non-Semantic Elements?
Ans: Semantic elements are the new features and those are part of HTML5. They intend to help the developers for creating the page structure quicklyA semantic element consists meaning to expressed to both the browser and the developer. Also, all the modern browsers support this feature. and it is possible for a developer to train old browsers to handle unknown elements.
The Difference:  Semantic Vs Non-Semantic.
Semantic: These elements briefly describe their content.Non-semantic: These elements are without any definition. They don’t describe anything about their structure

25. Is there any instances where the text will appear outside of the browser?
Ans: By default, the text is wrapped to see within the browser window. if the text is one of the part of a table cell with a defined width, then the text could expand beyond the browser window.
any definition. They don’t describe anything about their structure.

26. What is formatting in HTML?
Ans: The HTML formatting is a process that format the text for a better look and feel. and It uses different tags to make text bold, italicized, underlined.

27. Can you represent a multi-colored text on a web page?
Ans: Yes. To create a multicolor text on a web page you can use for the specific texts you want to color.

28. Why is a URL encoded in HTML?
Ans: 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 URL contains characters outside the ASCII set, the URL has to be changed. The non-ASCII characters are replaced with a “%” followed hexadecimal digits.

29. When is it appropriate to use frames?
Ans: Frames can make navigating a site much easier. If the main links to the site are placed in a frame that can be seen at the top or along the edge of the browser, the content for those links can be appeared in the remainder of the browser window.

30. Can we change inline elements into block-level elements?
Ans: Yes, we can change inline elements into block-level elements by adding display equal to the block in its CSS tag. Writing it will convert the inline elementAs into block elements and then inline elements will also take the full width of the container.

31. What Is The Aim Of Application Cache In HTML5? What Are Its Advantages?
Ans: HTML5 introduced the concept of Application Cache. It means that a web application is cached, and is accessible without an internet connection.Following are the key advantages of Application Cache.

Offline browsing: Users can use the application even when they are offline.
Speed: Cached resources load faster as compared to content that gets
downloaded, directly from the server.
Reduced server load: The browser will only download updated/modified resources from
the server.

32. What Is The Major Difference Between, Transitional And Strict Doctype?
Ans: Strict: This DTD contains all HTML components and properties. However, it does NOT INCLUDE presentational or expostulated components (like text style). It does not permit the use of Framesets.
Transitional: This DTD contains all HTML components and properties, INCLUDING presentational and belittled components (like textual style). It does not allow the use of Framesets.

33. What are the storage types of HTML5?
Ans: Two storage type of HTML5 are.
Session Storage: It can store the infomation related to the current.
Local Storage: In this data will not be erased when the browser is closed.

34. What are applets?
Ans: basically it is one of the HTML Interview Question in an HTML Interview. Applets are the small program which can be embedded with the web pages to perform some specific functionality like computation, animation

35. What are cell spacing and cell padding?
Ans: Cell spacing the attribute that defines the width of the border of the HTML page and Cell padding is the attribute which defines the space between the cell content.

36. Name the advantage of collapsing white space?
Ans:
 White spaces are a blank sequence of space characters, that is treated as a single space character in HTML. Because the browser collapses various spaces into a single space, you can indent lines of text without worrying about multiple spaces. This enables you to organize the HTML code into a more readable format.

37. Is it possible to change the color of the bullet?
Ans: The color of the bullet have always the color of the first text of the list. if you want to convert the color of the bullet, you must change the color of the text.

38. Does a tag is a HTML tag?
Ans: No, the 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 , XHTML 1.0 Frameset, XHTML 1.1 etc. So, is used to guide the web browser about the HTML page.

39. What is the benfit of figcaption tag in HTML 5?
Ans:
element is used to provide a caption to an image. It is an optional tag and can appear before or after the content within the tag. The element is used with element and it can be placed as the first or last child of the
element.
example: A front view of the great china wall in china.

40. What is a marquee?
Ans: Marquee is used for the scrolling text on a web page. It scrolls the image or text up, down, and left or right automatically. You should put the text which you want to scroll within the …… tag

41. Explain The Key Differences Between LocalStorage And SessionStorage Objects.
Ans: The key differences between localStorage and sessionStorage objects are as follows.The localStorage object stores the data without an expiry date. However, sessionStorage object stores the data for only one session.
In the case of a localStorage object, data will not delete when the browser window closes. However, the data gets deleted if the browser window closes, in the case of sessionStorage objects.
The data in sessionStorage is accessible only in the current window of the browser. But, the data in the localStorage can be shared between multiple windows of the browser.

42. What browsers support HTML5?
Ans: All modern browsers support HTML5, however some older browsers do not. fortunately most browsers will simply handle the new elements as inline elements. You can use CSS to change certain elements to be displayed as block-level elements where needed.

43. What is Longdesc in HTML?
Ans: Longdesc is an attribute that allows you to provide a Link to another page that consists a description of the frame contents. For example longdesc=”framedescription.html”

44. What do you mean by Box Model?
Ans: Every Element on a Page has a Rectangular Box and may have Width, Height, Padding, Borders, and Margins. Every section of the box model links to a CSS property: width, height, padding, border, and margin.

45. What are some common lists that are used when designing a page?
Ans: There are many common lists which 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 numbered format.
Unordered list:  The unordered list displays elements in bulleted format. Definition list:  The definition list displays elements in definition form like in dictionary.  and The tags are used to define description list.

46. Distinguish between progress and meter tag?
Ans: The progress tag is used to show the result of the task only while the meter tag is used to measure data within a given range.

47. Does a hyperlink only apply to text?
Ans: No, you can use hyperlinks to both text nd images. The HTML anchor tag defines a hyperlink that which links one page to another page. The “href” attribute is very important attribute of the HTML anchor tag.

48. What is datalist tag?
Ans: The HTML 5 datalist tag gives an autocomplete feature on the form element. It facilitates users to choose the predefined options to the users to select data.

49. Define forms in HTML.
Ans: Forms in HTML are required when we want to collect the user information whenever a user fills any form or provides any details and when we want to save it into our database.

50. Define iframe in HTML?
Ans: Iframe tag is written as iframe.

An iframe is used to show various document content inside the different document content in a rectangular region in the browser. When different document content is embedded into a current HTML content, then is called as as an inline iframe.

Note: Browse latest Html interview questions and    html tutorial. Here you can check  html  Training details and   html  training videos for self learning. Contact +91 988 502 2027 for more information.

All HTML Interview Questions

Instructor Led Training

Duration: 20-25 Hours
18,000
  • Experienced Faculty
  • Real time Scenarios
  • Free Bundle Life time Access
  • 100% Hands-on Classes
  • Sample CV/Resume
  • Interview Q&A
  • Instructor Led Live Online Classes
  • Instant Doubt Clarification