Top 50 HTML Interview Questions and Answers in 2022 | Edureka

HTML is one of the most widely used languages on Web to develop web pages. It helps you delve into the populace of Web Development and improve your skills. so, if you are planning to start your career in Web Development or HTML and you wish to know the skills related to it, now is the right clock time to dive in. These HTML Interview Questions and Answers will help you get through your interviews in 2022 .

HTML Interview Questions

Q1. What is HTML?

HTML stands for Hyper Text Markup Language. It is a speech of the World Wide Web. It is a standard text format terminology which is used to create and display pages on the Web. HTML makes the text more synergistic and dynamic. It can turn text into images, tables, links. HTML pages are saved by adding .html or .html in web page name .

Q2. What is the difference between HTML elements and tags?

Elements Tags
The chemical element is an person part of the HTML vane page or document. It represents semantics or entail. For example, the title component represents the claim of the document . It is the etymon of the HTML document which is used to specify that the document is HTML. For exercise, the Head tag is used to contain all the head element in the HTML file.

Q3. What are Attributes and how do you use them?

Each tag has extra attributes that change the way the chase behaves or is displayed. For exercise, a tag has a type attribute, which you can use to specify whether it ’ s a textbook field, checkbox, radio button or one of many more options.
Attributes are specified directly after the name of the tag, inside the two angled brackets. They should only ever appear in opening tags or in self-closing tags. But, they can never be in closing tags. Example:








Q4. What is the difference between a block-level element and an inline element?

Block Inline
A block-level element is drawn as a block that stretches to fill the full width available to it i.e, the width of its container and will always start on a new line.
Elements that are block-level by default:

, ,

,

,

Inline elements are drawn where they are defined and only take up space that is absolutely needed. The easiest way to understand how they work is to look at how text flows on a page.
Examples of elements that are inline by default: , , ,, .

Q5. When are comments used in HTML?

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 early developers as to what a section of HTML is for. The beginning of the gloss 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 :





Q6. What are the HTML tags used to display the data in the tabular form?

The list of HTML tags used to display data in the tabular shape include :

element to specify column properties for each column

Tag Decsription

It defines a postpone

This tag defines a row in a table

It defines a header cell in a board

This is used to define a cellular telephone in a table

It defines the table subtitle

It specifies a group of one or more columns in a table for formatting

This is used with

This tag is used to group the body content in a table .

It is used to group the header subject in a table
It is used to group the pedestrian contentedness in a table

Q7. How to create a Hyperlink in HTML?

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 watch 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.

The syntax of Hyperlink in HTML is :

 Link Text 

Q8. Name some common lists that are used when designing a page.

There are many coarse lists used for design a page. You can choose any or a combination of the take after list types :

  • Ordered list – The ordered list displays elements in a numbered format. It is represented by
      tag.
  • Unordered list – The unordered list displays elements in a bulleted format. It is represented by
      tag.
  • Definition list – The definition list displays elements in definition form like in a dictionary. The
    ,

    and

    tags are used to define description list.

Q9. What is semantic HTML?

semantic HTML is a tease style. It is the use of HTML markup to reinforce the semantics or meaning of the content. For model : In semantic HTML rag is not used for bold instruction a well as tag is used for italic. alternatively of these we use and tags .

Q10. How to create a nested webpage in HTML?

The HTML iframe chase is used to display a cuddle web page. In early words, it represents a web page within a web page. The HTML






HTML example

Use the height and width attributes to specify the size of the iframe:

Q11. What is an image map?

An double map is used for linking many different web pages using a one image. It is represented by

tag. You can define shapes in images that you want to include as part of an image mapping.

Q12. Does a hyperlink only apply to text?

No, hyperlinks can be used both on texts and images. The HTML anchor tag defines a hyperlink that links one foliate to another page. The “ href ” assign is the most crucial assign of the HTML anchor chase. Syntax:

 Link Text 

Q13. What is a Style Sheet?

A style sheet is used to build a consistent, movable, and well-designed style template. You can add these templates on several unlike world wide web pages. It describes the look and format of a document written in the markup language .

Q14. Explain the layout of HTML.

HTML layout specifies a way in which the web page is arranged. Every web site has a specific layout to display subject in a specific manner. Following are different HTML elements which are used to define the different parts of a web page : HTML-Structure- HTML Interview questions - edureka


  • : It is used to define a header for a document or a section.


  • : This defines a container for navigation links


  • : It is used to define a section in a document


  • : This is used to define an independent, self-contained article


  • : It is used to define content aside from the content


  • : It is used to define a footer for a document or a section

Q15. What is a marquee?

Marquee is used for the scrolling text on a web foliate. It scrolls the trope or text up, down, left or right automatically. You should put the textbook which you want to scroll within the …… tag .

Q16. What are the tags used to separate a section of texts?

There are three tags that can be used to separate the text :


  • tag – Usually
    tag is used to separate the line of text. It breaks the current line and conveys the flow to the next line
  • tag – This contains the text in the form of a new paragraph.

  • tag – It is used to define a large quoted section. If you have a large quotation, then put the entire text within

    ……….

    tag.

Q17. What is the difference between DIV and SPAN in HTML?

The remainder between span and div is that a couple chemical element is in-line and normally used for a belittled ball of HTML inside a telephone line, such as inside a paragraph. Whereas, a div or class element is block-line which is equivalent to having a line-break earlier and after it and used to group larger chunks of code. Example:

This is interview

Q18. What is the purpose of using alternative texts in images?

The function of using alternative text is to define what the double is about. During an effigy mapping, it can be confusing and unmanageable to understand what hotspots match to a particular link. These option text come in action here and put a description at each associate which makes it easy for users to understand the hot spot links well .

Q19. How to create a new HTML element?

You can create newly elements for the text file in the following room :


It can be besides be used in the HTML as :

hello edureka!

Q20. Is the

tag considered as a HTML tag?

No, the hypertext markup language resolution is not an HTML tag. There are many type of HTML, such as, 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. sol, hypertext markup language is used to instruct the web browser about the HTML foliate.

Q21. Why is a URL encoded in HTML?

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 merely. 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 .

Q22. What is the use of an iframe tag?

An iframe is used to display a web page within a web page. Syntax:



Example:



Target to a link:



Q23. What are the entities in HTML?

The HTML character entities are used as a surrogate for allow characters in HTML. You can besides replace characters that are not present on your keyboard by entities. These characters are replaced because some characters are reserved in HTML .

Q24. Can you create a multi-colored text on a web page?

Yes, we can create a motley textbook on a web page. To create a motley textbook, you can use for the specific text that you want to color .

Q25. How to make a picture of a background image of a web page?

To make a word picture a background image on a web foliate, you should put the come tag code after the

tag.


here, replace the “ image.gif ” with the name of your trope file which you want to display on your world wide web page .

Q26. What is the use of a span tag? Explain with example.

The span chase is used for following things :

  • For adding color on text
  • To add background on text
  • Highlight any color text

Example:


In this page we use span.


Q27. What is the advantage of collapsing white space?

White spaces are a blank sequence of quad characters, which is treated as a single outer space character in HTML. Because the browser collapses multiple spaces into a single space, you can indent lines of textbook without worrying about multiple spaces. This enables you to organize the HTML code into a much more clear format .

Q28. Is there any way to keep list elements straight in an HTML file?

By using indents, you can keep the tilt elements directly. If you indent each substitute nested list in far than the parent list, you can easily determine the assorted lists and the elements that it contains .

Q29. Explain The Key Differences Between LocalStorage And SessionStorage Objects.

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.

Q30. When is it appropriate to use frames?

Frames can make navigating a site much easier. If the main links to the locate are located in a frame that appears at the top or along the edge of the browser, the message for those links can be displayed in the remainder of the browser window .

Q31. How to insert a picture into a background image of a web page?

To insert a picture into the background trope, you need to place a tag code after the tag in the following way:


now, replace image.gif with the appoint of your picture file. This will take the picture and make it the background image of your web page .

Q32. What happens if you open the external CSS file in a browser?

When you try to open the external CSS file in a browser, the browser can not open the file, because the file has a different extension. The lone way to use an external CSS file is to reference it using tag within another HTML document .

Q33. What is the hierarchy that is being followed when it comes to style sheets?

If a single selector includes three unlike style definitions, the definition that is closest to the actual tag takes precedence. Inline manner takes precedence over embedded style sheets, which takes priority over external dash sheets .

Q34. How do you create text on a webpage that allows you to send an email when clicked?

To change the text into a clickable link to send an electronic mail, you need to use the mailto command within the href tag. You can write it in the follow manner :

text to be clicked

Q35. How are active links different from normal links?

The default coloring material for convention and active links is blue. Some browsers recognize an active associate when the mouse cursor is placed over that link. Whereas, others recognize active links when the link has the focus. Those that don ’ t have a mouse cursor over that yoke is considered a normal connect .

Q36. What are the different tags to separate sections of text?

The
tag is one manner to separate the lines of textbook. There are other tags like the

tag and

tag that are also used to separate sections of text.

Q37. Are there instances where the text will appear outside of the browser?

By default, the text is wrapped to appear within the browser window. However, if the text is part of a table cell with a defined width, the text could extend beyond the browser window.

Q38. Write an HTML table tag sequence that outputs the following:
50 pcs 100 500
10 pcs 5 50

The HTML Code for the above problem is:

50 pcs 100 500
10 pcs 5 50

Q39. What is the advantage of grouping several checkboxes together?

The checkboxes don’t affect one another. But, grouping these checkboxes together help to organize them. Checkbox buttons can have their name and do not need to belong to a group. A single web page can have many different groups of checkboxes.

Q40. What happens if there is no text between the tags? Does this affect the display of the HTML file?

If there is no text present between the tags, there is nothing to format. Therefore, no formatting will appear. Some tags, such as the tags without a closing tag like the tag, do not require any text between them.

Q41. What are the limits of the text field size?

The default size for a text field is around 13 characters. However, if you include the size attribute, you can set the size value to be as low as 1. The maximum size value will be determined by the browser width. Also, if the size attribute is set to 0, the size will be set to the default size of 13 characters.

Q42. What is the relationship between the border and rule attributes?

Default cell borders, with a thickness of 1 pixel, are automatically added between cells if the border attribute is set to a nonzero value. Similarly, If the border attribute is not included, a default 1-pixel border appears when the rules attribute is added to the

tag.

Q43. What is SVG?

HTML SVG is used to describe the two-dimensional vector and vector or 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.





Q44. What is button tag?

The button tag is used in HTML 5. It is used to create a clickable button within the HTML form on the web page. This tag creates a “submit” or “reset” button. The button tag code is as follows:

Q45. List the media types and formats supported by HTML.

HTML supports a wide range of media formats for sound, music, videos, movies, and animations. Some of the extensions supported by each media format are:

  • Images– png, jpg, jpeg, gif, apng, svg, bmp, BMP ico, png ico
  • Audio– MIDI, RealAudio, WMA, AAC, WAV, Ogg, MP3, MP4
  • Video– MPEG, AVI, WMV, QuickTime, RealVideo, Flash, Ogg, WebM, MPEG-4 or MP4

Q46. What is Cell Spacing and Cell Padding?

Cell Spacing is referred to as the space or gap between the two cells of the same table. Whereas, Cell Padding is referred to as the gap or space between the content of the cell and cell wall or cell border.

Example:

Q47. What is difference between HTML and XHTML?

The differences between HTML and XHTML are:

  • HTML is an application of Standard Generalized Markup Language. Whereas, XML is an application of Extensible Markup Language.
  • The first one is a static Web Page whereas the later one is a dynamic Web Page.
  • HTML allows programmer to perform changes in the tags and use attribute minimization whereas XHTML when user need a new markup tag then user can define it in this.
  • HTML is about displaying information whereas XHTML is about describing the information.

Q48. How many types of CSS can be included in HTML?

There are three ways to include the CSS with HTML:

  • Inline CSS: It is used for styling small contexts. To use inline styles add the style attribute in the relevant tag.
  • External Style Sheet: This is used when the style is applied to many pages. Each page must link to the style sheet using the tag. The tag goes inside the head section.




  • Internal Style Sheet: It is used when a single document has a unique style. Internal styles sheet needs to put in the head section of an HTML page, by using the

Q49. What are logical and physical tags in HTML?

Logical tags are used to tell the mean of the enclose text. The example of the coherent rag is tag. When we enclose the text in the strong tag, it tells the browser that enclosed text is more crucial than other text. Physical tags are used to tell the browser how to display the text enclosed in the forcible tag. Some of the examples of physical tags are , , .

Q50. How can you apply JavaScript to a web page?

In ordering to make your web page more interactional, you need JavaScript. It is a script terminology that allows you to interact with certain elements on the page, based on exploiter input signal. As with CSS, there are three main ways of including JavaScript : Inline Certain HTML elements allow you to execute a piece of JavaScript when a certain event occurs. For example, a release allows you to run a handwriting when you click on it. These events are accessed through attributes and differ based on the events that are available on each element. here is an model that shows an alarm with a message when the user clicks on it :

Script block You can define a script blockage anywhere on the foliate, which will get executed american samoa soon as the browser reaches that part of the document. This can be inside the or section of your document.


Link to a JavaScript file It allows you to keep the content of the page offprint to how users interact with that contentedness. besides, it allows you to load the same script on multiple pages. As with the handwriting block, you can load a JavaScript file from the or .

With this, we have come to the end of HTML interview questions blog. I Hope these HTML Interview Questions will help you in your interviews. In case you have attended any such consultation in the holocene by, do paste those interview questions in the comments section and we ’ ll answer them. You can besides comment below if you have any questions in your beware, which you might face in your Web Development interview. Check out our Full Stack Web Developer Masters Program which comes with instructor-led live aim and real-life visualize experience. This train makes you adept in skills to work with back-end and front-end web technologies. It includes training on Web Development, jQuery, Angular, NodeJS, ExpressJS, and MongoDB. Got a doubt for us ? Please note it in the comments department of “ HTML Interview Questions ” blog and we will get back to you .

beginning : https://gauday.com
Category : interview

We will be happy to hear your thoughts

Leave a reply

GauDay Crypto news and market tracking in real time
Logo
Enable registration in settings - general