Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9
HTML INTERVIEW QUESTIONS
1. What does HTML stand for?
● HTML stands for Hypertext Markup Language. 2. What is the use of HTML? ● HTML is the standard markup language it is used for creating Web pages , HTML is used to create the structure and content of web pages . It consists of a series of elements. HTML elements tell the browser how to display the content . 3. What are the different versions of HTML? ● HTML, HTML 4.01, XHTML, HTML5. 4. What is the latest version of HTML? ● HTML5. 5. What are tags in HTML? ● Tags are the fundamental building blocks of HTML. Almost all tags contain two parts, an opening, and a closing tag. 6. What is an element in HTML? ● An element consists of an opening tag, content, and a closing tag, if applicable. 7. What is an attribute in HTML? ● An attribute provides additional information about an element and is defined within the opening tag. 8. What is the purpose of a DOCTYPE declaration? ● It specifies the version of HTML used in the document to the browser. 9. What is the structure of an HTML document? <!DOCTYPE html> <html> <head> </head> <body> </body> </html> 10.What is the purpose of the <head> tag in HTML? ● It contains meta-information about the HTML document, such as the title, character set, and CSS or JavaScript links. HTML Tags:
11.Explain the <div> tag in HTML.
● It is a block-level element used to group content and apply styles. 12.Explain the <span> tag in HTML. ● It is an inline element used to apply styles to a specific part of the text. 13.What is the purpose of the <p> tag? ● It defines a paragraph. 14.How do you create headings in HTML? ● Using <h1> to <h6> tags. 15.Explain the <a> tag and its attributes. ● It creates hyperlinks. Attributes include href, target, and title. 16.How do you create a hyperlink in HTML? ● Using the <a> tag with the href attribute. 17.What is the difference between absolute and relative URLs? ● Absolute URLs include the full path, while relative URLs specify the path relative to the current page. 18.How do you create an image in HTML? ● Using the <img> tag with the src attribute. 19.Explain the <img> tag and its attributes. ● It embeds images. Attributes include src, alt, width, and height. 20.What is the purpose of the <alt> attribute in the <img> tag? ● It specifies alternative text for the image, which is displayed if the image fails to load. 21.How do you create a line break in HTML? ● Using the <br> tag. 22.Explain the <br> tag. ● It inserts a line break in the text. 23.How do you create a horizontal line in HTML? ● Using the <hr> tag. 24.Explain the <hr> tag. ● It creates a horizontal rule or line. 25.What is the purpose of the <strong> and <em> tags? ● <strong> is used to highlight important text, and <em> is used for emphasizing text. 26.What is the <blockquote> tag used for? ● It indicates that the enclosed text is a longer quotation. 27.How do you create a list in HTML? ● Using <ul> for unordered lists and <ol> for ordered lists. 28.Explain the <ul> and <ol> tags. ● <ul> creates an unordered list, and <ol> creates an ordered list. 29.How do you create a table in HTML? ● Using the <table>, <tr>, <td>, and <th> tags. 30.Explain the <table>, <tr>, <td>, and <th> tags. ● <table> defines a table, <tr> defines a row, <td> defines a cell, and <th> defines a header cell.
Forms:
31.What is the purpose of the <form> tag?
● It defines an HTML form to collect user input. 32.How do you create a form in HTML? ● Using the <form> tag. 33.Explain the <input> tag and its types. ● <input> creates form controls. Types include text, password, checkbox, radio, etc. 34.What is the difference between the GET and POST methods? ● GET appends form data to the URL, while POST sends data in the request body. 35.How do you create a text input field? ● <input type="text"> 36.How do you create a password input field? ● <input type="password"> 37.How do you create a checkbox? ● <input type="checkbox"> 38.How do you create a radio button? ● <input type="radio"> 39.How do you create a dropdown list? ● Using the <select> and <option> tags. 40.How do you create a submit button? ● <input type="submit"> 41.How do you create a reset button? ● <input type="reset"> 42.What is the purpose of the <label> tag? ● It defines a label for an input element. 43.How do you associate a label with an input field? ● By using the for attribute in <label> and the id attribute in the corresponding input field. 44.Explain the <textarea> tag. ● It creates a multiline text input field. Semantic HTML:
45.What is semantic HTML?
● It is using HTML tags that convey meaning about the content they contain. 46.Why is semantic HTML important? ● It improves accessibility, search engine optimization, and code readability. 47.Give examples of semantic HTML tags. ● <header>, <footer>, <nav>, <article>, <section>, <aside>, <main>. 48.Explain the <header> and <footer> tags. ● <header> represents introductory content or a group of navigational links. <footer> represents a footer for its nearest section. 49.Explain the <nav> tag. ● It defines navigation links. 50.What is the purpose of the <article> tag? ● It defines an independent, self-contained content. 51.What is the purpose of the <section> tag? ● It defines a thematic grouping of content. 52.What is the purpose of the <aside> tag? ● It represents content aside from the content it is placed in. 53.Explain the <main> tag. ● It represents the main content of the document. 54.How do you create a semantic HTML5 document structure? ● By using <header>, <nav>, <main>, <section>, <article>, <aside>, and <footer> tags appropriately.
HTML5 Features:
55.What are the new features introduced in HTML5?
● Canvas, audio/video elements, local storage, geolocation, semantic elements, etc. 56.Explain the <canvas> tag. ● It is used to draw graphics using JavaScript. 57.What is the purpose of the <audio> and <video> tags? ● They are used to embed audio and video content, respectively. 58.How do you embed audio and video in HTML5? ● Using the <audio> and <video> tags with the src attribute. 59.What is the purpose of the <details> and <summary> tags? ● They are used to create collapsible content sections. 60.Explain the <figure> and <figcaption> tags. ● <figure> is used to group media content, and <figcaption> provides a caption for the content. 61.What is the purpose of the <progress> tag? ● It represents the progress of a task. 62.How do you create a progress bar in HTML5? ● Using the <progress> tag with the value attribute. 63.What is the purpose of the <meter> tag? ● It represents a scalar measurement within a known range. 64.How do you create a meter in HTML5? ● Using the <meter> tag with the value and min/max attributes. 65.What is the purpose of the <datalist> tag? ● It provides a list of predefined options for input elements. 66.How do you create a datalist in HTML5? ● Using the <datalist> tag with <option> child elements.
Accessibility:
67.What is web accessibility?
● Web accessibility ensures that websites and web applications are usable by people with disabilities. 68.Why is web accessibility important? ● It ensures equal access to information and services for everyone. 69.What are some common accessibility features in HTML? ● Providing alt attributes for images, using semantic HTML elements, creating accessible forms, etc. 70.How do you create accessible forms? ● By using appropriate labels, providing instructions, and ensuring proper tab order. 71.What is the purpose of the alt attribute in the <img> tag? ● It provides alternative text for images for accessibility and when the image fails to load. 72.How do you ensure images are accessible to screen readers? ● By providing descriptive alt attributes for images. 73.How do you create accessible tables? ● By using appropriate table headers (<th>), captions (<caption>), and summary attributes. 74.What is the purpose of the <title> tag? ● It defines the title of the HTML document, which appears in the browser's title bar or tab. 75.How do you create accessible links? ● By using descriptive link text and avoiding generic phrases like "click here."
Meta Tags and SEO:
76.What is the purpose of the <meta> tag?
● It provides metadata about the HTML document, such as character encoding, viewport settings, and SEO information. 77.How do you specify the character encoding in HTML? ● By using the charset attribute in the <meta> tag within the <head> section. 78.What is the viewport meta tag used for? ● It controls the layout and scaling of the viewport on mobile browsers. 79.How do you specify keywords and descriptions for SEO? ● By using the keywords and description meta tags. 80.What is the purpose of the robots meta tag? ● It instructs search engine crawlers on how to index and display the page content. 81.How do you specify the canonical URL? ● By using the rel="canonical" attribute in the <link> tag. 82.What is microdata and how is it used for SEO? ● Microdata is a way to provide additional context about the content on a web page, which can improve SEO. 83.What are rich snippets? ● They are enhanced search results displayed by search engines, often including additional information like ratings and reviews.
Responsive Web Design:
84.What is responsive web design?
● It is an approach to designing websites that adapt to different screen sizes and devices. 85.How do you make a website responsive? ● By using fluid grids, flexible images, and media queries. 86.What is a media query? ● It is a CSS technique used to apply different styles based on the device's characteristics. 87.How do you use media queries in CSS? ● By specifying conditions within @media rules to apply styles based on viewport size, resolution, etc. 88.What is a mobile-first approach in responsive design? ● It involves designing for mobile devices first and then scaling up for larger screens. 89.What is the purpose of the viewport meta tag in responsive design? ● It controls the layout viewport's dimensions and scaling on mobile devices. 90.How do you create flexible layouts using CSS? ● By using percentage-based widths, max-width properties, and flexible units like ems or rems.
Cross-Browser Compatibility:
91.What is cross-browser compatibility?
● It ensures that a website or web application works correctly across different web browsers. 92.Why is cross-browser compatibility important? ● It ensures a consistent user experience for all visitors regardless of the browser they use. 93.What are some common issues with cross-browser compatibility? ● Differences in rendering, CSS support, JavaScript behavior, etc. 94.How do you ensure your website works well in different browsers? ● By testing in multiple browsers, using feature detection, and applying CSS resets. 95.What tools can you use to test cross-browser compatibility? ● Browser developer tools, online testing platforms, and virtual machines.
Performance Optimization:
96.What is website performance optimization?
● It involves improving a website's speed and efficiency. 97.How do you optimize images for the web? ● By using the appropriate file format, resizing and compressing images, and lazy loading. 98.What are CSS sprites? ● They are a technique for combining multiple images into a single image to reduce HTTP requests. 99.What is lazy loading? ● It defers the loading of non-essential resources, such as images, until they are needed. 100. How do you minimize HTTP requests? - By combining files, using CSS sprites, and reducing unnecessary scripts and stylesheets.