Technical interview questions and answers are essential when preparing for an HTML Interview because HTML forms the foundation of every web page. Recruiters want to evaluate your understanding of tags, attributes, forms, semantic elements, HTML5 features, media integration, and best coding practices. This topic is extremely common in frontend developer interviews, UI/UX roles, and full-stack development placements. Companies such as TCS, Infosys, Wipro, Cognizant, and Accenture frequently ask HTML questions to check whether candidates have strong web development fundamentals. This guide includes the most commonly asked HTML interview questions with explanations designed to help freshers and job seekers prepare effectively. Mastering these questions will help you perform confidently during coding tests, web design discussions, and campus placements.
1. What is HTML?
Answer: HTML, or HyperText Markup Language, is a Universal language which allows an individual using special code to create web pages to be viewed on the Internet.
Show Answer
Hide Answer
2. What is a tag?
Answer: In HTML, a tag tells the browser what to do. When you write an HTML page, you enter tags for many reasons -- to change the appearance of text, to show a graphic, or to make a link to another page.
Show Answer
Hide Answer
3. How do I create frames? What is a frameset?
Answer: Frames allow an author to divide a browser window into multiple (rectangular) regions. Multiple documents can be displayed in a single window, each within its own frame. Graphical browsers allow these frames to be scrolled independently of each other, and links can update the document displayed in one frame without affecting the others.
You can't just "add frames" to an existing document. Rather, you must create a frameset document that defines a particular combination of frames, and then disp
Show Answer
Hide Answer
4. What is a Hypertext link?
Answer: A hypertext link is a special tag that links one page to another page or resource. If you click the link, the browser jumps to the link's destination.
Show Answer
Hide Answer
5. How comfortable are you with writing HTML entirely by hand?
Answer: Very. I dont usually use WYSIWYG. The only occasions when I do use Dreamweaver are when I want to draw something to see what it looks like, and then Ill usually either take that design and hand-modify it or build it all over again from scratch in code. I have actually written my own desktop HTML IDE for Windows (Its called Less Than Slash) with the intention of deploying it for use in web development training. If has built-in reference features, and will autocomplete code by parsing the DTD y
Show Answer
Hide Answer
6. What is everyone using to write HTML?
Answer: Everyone has a different preference for which tool works best for them. Keep in mind that typically the less HTML the tool requires you to know, the worse the output of the HTML. In other words, you can always do it better by hand if you take the time to learn a little HTML.
Show Answer
Hide Answer
7. What is a DOCTYPE? Which one do I use?
Answer: According to HTML standards, each HTML document begins with a DOCTYPE declaration that specifies which version of HTML the document uses. Originally, the DOCTYPE declaration was used only by SGML-based tools like HTML validators, which needed to determine which version of HTML a document used (or claimed to use).
Today, many browsers use the document's DOCTYPE declaration to determine whether to use a stricter, more standards-oriented layout mode, or to use a "quirks" layout mode that attempts
Show Answer
Hide Answer
8. Do I have to memorize a bunch of tags?
Answer: No. Most programs that help you write HTML code already know most tags, and create them when you press a button. But you should understand what a tag is, and how it works. That way you can correct errors in your page more easily.
Show Answer
Hide Answer
10. How can I eliminate the extra space after a tag?
Answer: HTML has no mechanism to control this. However, with CSS, you can set the margin-bottom of the form to 0. For example:
Show Answer
Hide Answer
11. Can I have two or more actions in the same form?
Answer: No. A form must have exactly one action. However, the server-side (e.g., CGI) program that processes your form submissions can perform any number of tasks (e.g., updating a database, sending email, logging a transaction) in response to a single form submission.
Show Answer
Hide Answer
12. How can I use forms for pull-down navigation menus?
Answer: There is no way to do this in HTML only; something else must process the form. JavaScript processing will work only for readers with JavaScript-enabled browsers. CGI and other server-side processing is reliable for human readers, but search engines have problems following any form-based navigation.
Show Answer
Hide Answer
13. Why doesn't
use the full browser width?
Answer: Graphical browsers leave a narrow margin between the edge of the display area and the content.
Also note that Navigator always leaves room for a scrollbar on the right, but draws the scrollbar only when the document is long enough to require scrolling. If the document does not require scrolling, then this leaves a right "margin" that cannot be removed.
Show Answer
Hide Answer
14. How do I create a link that sends me email?
Answer: Use a mailto link, for example
Show Answer
Hide Answer
15. How can I show HTML examples without them being interpreted as part of my document?
Answer: Within the HTML example, first replace the "&" character with "&" everywhere it occurs. Then replace the "<" character with "<" and the ">" character with ">" in the same way.
Note that it may be appropriate to use the CODE and/or PRE elements when displaying HTML examples.
Show Answer
Hide Answer
16. How do I eliminate the blue border around linked images?
Answer: In your HTML, you can specify the BORDER attribute for the image:

However, note that removing the border that indicates an image is a link makes it harder for users to distinguish quickly and easily which images on a web page are clickable.
Show Answer
Hide Answer
17. How do I change the title of a framed document?
Answer: The title displayed is the title of the frameset document rather than the titles of any of the pages within frames. To change the title displayed, link to a new frameset document using TARGET="_top" (replacing the entire frameset).
Show Answer
Hide Answer
18. How do I link an image to something?
Answer: Just use the image as the link content, like this:
Show Answer
Hide Answer
19. How do I specify a specific combination of frames instead of the default document?
Answer: This is unfortunately not possible. When you navigate through a site using frames, the URL will not change as the documents in the individual frames change. This means that there is no way to indicate the combination of documents that make up the current state of the frameset.
The author can provide multiple frameset documents, one for each combination of frame content. These frameset documents can be generated automatically, perhaps being created on the fly by a CGI program. Rather than linki
Show Answer
Hide Answer
20. How do I create a link?
Answer: Use an anchor element. The HREF attribute specifies the URL of the document that you want to link to. The following example links the text "Web Authoring FAQ" to
:
Web Authoring FAQ
Show Answer
Hide Answer
23. How do I specify page breaks in HTML?
Answer: There is no way in standard HTML to specify where page breaks will occur when printing a page. HTML was designed to be a device-independent structural definition language, and page breaks depend on things like the fonts and paper size that the person viewing the page is using.
Show Answer
Hide Answer
24. How do I remove the border around frames?
Answer: Removing the border around frames involves both not drawing the frame borders and eliminating the space between the frames. The most widely supported way to display borderless frames is
Show Answer
Hide Answer
25. Why doesn't my title show up when I click "check it out"?
Answer: You're probably looking at the wrong part of the screen. The Title usually shows up in the Title Bar on the Window, to the left of the minimize/maximize buttons on graphical browsers.
Show Answer
Hide Answer
26. What is the difference between the HTML form methods GET and POST?
Answer: The method parameter specifies which method the client is using to send information to the WEB server. The method determines which parameter you will find the CGI request data in:
* POST - post_args
* GET - httpargs
Show Answer
Hide Answer
27. How do I put sounds for older versions of Internet Explorer?
Answer: For older versions of Internet Explorer, this technique was used .
Show Answer
Hide Answer
28. Can I use any HTML in the box?
Answer: Yes. Any HTML tag that your browser supports will work in the box. So you can carry tags from chapters to chapters and mix and match...
Show Answer
Hide Answer
29. How to transferring user to new web page automatically?
Answer: You will need to use the below meta tag.
Placing the above tag in your will load yousite.com in 2 seconds.
Changing the 2 value on CONTENT="2" to another value will increase or decrease the delay until loading the new page.
Show Answer
Hide Answer
30. How do I keep people from stealing my source code and/or images?
Answer: Because copies of your HTML files and images are stored in cache, it is impossible to prevent someone from being able to save them onto their hard drive. If you are concerned about your images, you may wish to embed a watermark with your information into the image. Consult your image editing program's help file for more details.
Show Answer
Hide Answer
31. The colors on my page look different when viewed on a Mac and a PC.
Answer: The Mac and the PC use slightly different color palettes. There is a 216 "browser safe" color palette that both platforms support; the Microsoft color picker page has some good information and links to other resources about this. In addition, the two platforms use different gamma (brightness) values, so a graphic that looks fine on the Mac may look too dark on the PC. The only way to address this problem is to tweak the brightness of your image so that it looks acceptable on both platforms.
Show Answer
Hide Answer
32. How do you create tabs or indents in Web pages?
Answer: There was a tag proposed for HTML 3.0, but it was never adopted by any major browser and the draft specification has now expired. You can simulate a tab or indent in various ways, including using a transparent GIF, but none are quite as satisfactory or widely supported as an official tag would be.
Show Answer
Hide Answer
33. My page looks good on one browser, but not on another.
Answer: There are slight differences between browsers, such as Netscape Navigator and Microsoft Internet Explorer, in areas such as page margins. The only real answer is to use standard HTML tags whenever possible, and view your pages in multiple browsers to see how they look.
Show Answer
Hide Answer
34. Why does the browser show my plain HTML source?
Answer: If Microsoft Internet Explorer displays your document normally, but other browsers display your plain HTML source, then most likely your web server is sending the document with the MIME type "text/plain". Your web server needs to be configured to send that filename with the MIME type "text/html". Often, using the filename extension ".html" or ".htm" is all that is necessary. If you are seeing this behavior while viewing your HTML documents on your local Windows filesystem, then your text editor
Show Answer
Hide Answer
35. How can I display an image on my page?
Answer: Use an IMG element. The SRC attribute specifies the location of the image. The ALT attribute provides alternate text for those not loading images. For example:
Show Answer
Hide Answer
36. How do I get out of a frameset?
Answer: If you are the author, this is easy. You only have to add the TARGET attribute to the link that takes readers to the intended 'outside' document. Give it the value of _top.
In many current browsers, it is not possible to display a frame in the full browser window, at least not very easily. The reader would need to copy the URL of the desired frame and then request that URL manually.
I would recommend that authors who want to offer readers this option add a link to the document itself in the
Show Answer
Hide Answer
37. How do I make a frame with a vertical scrollbar but without a horizontal scrollbar?
Answer: The only way to have a frame with a vertical scrollbar but without a horizontal scrollbar is to define the frame with SCROLLING="auto" (the default), and to have content that does not require horizontal scrolling. There is no way to specify that a frame should have one scrollbar but not the other. Using SCROLLING="yes" will force scrollbars in both directions (even when they aren't needed), and using SCROLLING="no" will inhibit all scrollbars (even when scrolling is necessary to access the frame
Show Answer
Hide Answer
Questions and Answers for Competitive Exams Various Entrance Test