HTML Interview Questions

HTML Interview Questions and Answers

We can herewith list of latest and updated HTML interview questions and their answers for fresher’s as well as experienced users.  These interview question covers latest version of HTML. HTML is a format that tells a computer how to display a web page. The documents themselves are plain text files with special “tags” or codes that a web browser uses to interpret and display information on your computer screen. 

Best HTML Interview Questions and Answers

Using HTML, you describe how your document is structured so that web browsers can display it appropriately. Unlike normal desktop publishing, with HTML you only work in generalities, if you know what you’re doing. Rather than specifying exactly what your document looks like, you specify which parts of the document are important, and in what way they’re important. Here you can find top best HTML Interview Questions and Answers for beginners and professionals,

What is Hyper Text Markup Language (HTML)?

HTML ( Hyper Text Markup Language) is the language used to write Web pages. You are looking at a Web page right now.

You can view HTML pages in two ways:

  • One view is their appearance on a Web browser, just like this page — colors, different text sizes, graphics.
  • The other view is called “HTML Code” — this is the code that tells the browser what to do.

How can I include comments in HTML?

Technically, since HTML is an SGML application, HTML uses SGML comment syntax. However, the full syntax is complex, and browsers don’t support it in its entirety anyway. 

How comfortable are you with writing HTML entirely by hand?

Very. I don’t 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 I’ll 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 (it’s 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 you specify in the file. That is to say, the program doesn’t know 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.

What is everyone using to write HTML?

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. 

How do I use forms?

The basic syntax for a form is: <FORM ACTION=”[URL]”>…</FORM>

When the form is submitted, the form data is sent to the URL specified in the ACTION attribute. This URL should refer to a server-side (e.g., CGI) program that will process the form data. The form itself should contain

  • at least one submits button (i.e., an <INPUT TYPE=”submit” …> element),
  • form data elements (e.g., <INPUT>, <TEXTAREA>, and <SELECT>) as needed, and
  • additional mark up (e.g., identifying data elements, presenting instructions) as needed.

Do I have to memorize a bunch of tags?

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. 

How can I use forms for pull-down navigation menus?

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. 

Can I use percentage values for TD WIDTH=… tag?

The HTML 3.2 and HTML 4.0 specifications allow only integer values (representing a number of pixels) for the WIDTH attribute of the TD element. However, the HTML 4.0 DTD allows percentage (and other non-integer) values, so an HTML validator will not complain about <TD WIDTH=”xx%”>.

It should be noted that Netscape and Microsoft’s browsers interpret percentage values for <TD WIDTH=…> differently. However, their interpretations (and those of other table-aware browsers) happen to match when combined with <TABLE WIDTH=” 100%”>. In such situations, percentage values can be used relatively safely, even though they are prohibited by the public specifications.


HTML interview questions #Part II

Why is there extra space before or after my table?

This is often caused by invalid HTML syntax. Specifically, it is often caused by loose content within the table (i.e., content that is not inside a TD or TH element). There is no standard way to handle loose content within a table. Some browsers display all loose content before or after the table. When the loose content contains only multiple line breaks or empty paragraphs, then these browsers will display all this empty space before or after the table itself

The solution is to fix the HTML syntax errors. All content within a table must be within a TD or TH element.

How do I eliminate the space around/between my images?

If your images are inside a table, be sure to set the BORDER, CELL SPACING, and CELLPADDING attributes to 0.

Extra space between images is often created by whitespace around the <IMG> tag in the markup. It is safe to use newlines inside a tag (between attributes), but not between two tags. For example, replace this:

<td ...>
<img src=... alt=
<img src=... alt=...> </td>

with this:
<td .><img src=... alt=...><img src=... alt=...></td>

According to the latest specifications, the two should be equivalent. However, common browsers do not comply with the specifications in this situation.

Finally, extra space between images can appear in documents that trigger the “standards” rendering mode of Gecko-based browsers like Mozilla and Firefox.

How can I eliminate the extra space after a form tag?

HTML has no mechanism to control this. However, with CSS, you can set the margin-bottom of the form to 0. For example:

<form style="margin-bottom:0;" action=...>

You can also use a CSS style sheet to affect all the forms on a page: form 1 margin-bottom: 0 ; }

Can I have two or more actions in the same form?

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. 

How can I avoid using the whole URL?

The URL structure defines a hierarchy (or relationship) that is similar to the hierarchy of subdirectories (or folders) in the filesystems used by most computer operating systems. The segments of a URL are separated by slash characters (“I”). When navigating the URL hierarchy, the final segment of the URL (i.e., everything after the final slash) is similar to a file in a filesystem. The other segments of the URL are similar to the subdirectories and folders in a filesystem.

How can I show HTML examples without them being interpreted as part of my document?

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.

Should I put quotes around attribute values?

It is never wrong to quote attribute values, and many people recommend quoting all attribute values even when the quotation marks are technically optional. XHTML 1.0 requires all attribute values to be quoted. Like previous HTML specifications, HTML 4 allows attribute values to remain unquoted in many circumstances (e.g., when the value contains only letters and digits).

Be careful when your attribute value includes double quotes, for instance when you want ALT text like “the “King of Comedy” takes a bow” for an image. Humans can parse that to know where the quoted material ends, but browsers can’t. You have to code the attribute value specially so that the first interior quote doesn’t terminate the value prematurely. There are two main techniques:

Escape any quotes inside the value with ” so you don’t terminate the value prematurely: ALT=”the “King of Comedy” takes a bow”.

  • Use single quotes to enclose the attribute value: ALT=’the “King of Comedy” takes a bow’.

Both these methods are correct according to the specification and are supported by current browsers, but both were poorly supported in some earlier browsers. The only truly safe advice is to rewrite the text so that the attribute value need not contain quotes, or to change the interior double quotes to single quotes, like this: ALT=”the ‘King of Comedy’ takes a bow”. 

What is HTML for Lists?

  1. Bulleted Lists: <ul> begins a bulleted, indented list. Each item in the list is then prefaced with the <li> tag. It is not necessary to insert a break at the end of each line — the <li> tag automatically creates a new line.
  2. Numbered Lists: <ol> begins a numbered, indented list. Each item in the list is then prefaced with the <li> tag. You need to close the list with the </ol> tag.

How do I eliminate the blue border around linked images?

In your HTML, you can specify the BORDER attribute for the image:

<a hre...><img src=... alt=... border="0"></a>

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. 

HTML interview questions #Part III

How can I specify colors?

If you want others to view your web page with specific colors, the most appropriate way is to suggest the colors with a style sheet. Cascading Style Sheets use the color and background-color properties to specify text and background colors. To avoid conflicts between the reader’s default colors and those suggested by the author, these two properties should always be used together. With HTML, you can suggest colors with the TEXT, LINK, VL1NK (visited link), ALINK (active link), and BGCOLOR (background color) attributes of the BODY element.

Can I prevent a form from being submitted again?

No. The server-side (e.g., CGI) program that processes the form submission must handle duplicate submissions gracefully.

You could generate the form with a server-side (e.g., CGI) program that adds a hidden field with a unique session ID. Then the server-side program that processes the form submission can check the session ID against a list of previously used session IDs. If the session ID has already been used, then an appropriate action can be taken (e.g., reject the submission, or update the previously submitted data).

How do I specify a specific combination of frames instead of the default document?

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 linking to individual content documents, the author can link to these separate frameset documents using TARGET=” top”. Thus, the URL of the current frameset document will always specify the combination of frames being displayed, which allows links, bookmarks, etc. to function normally.

How do I let people download a file from my page?

Once the file is uploaded to the server, you need only use an anchor reference tag to link to it. An example would be:

<a hre"../files/foo.zip">Vkist Technosap Now! (100kb ZIP)</a>

How do I remove the border around frames?

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 <FRAME SET … B ORDER=0 FRAMEBORDER=O FRAME SPACING= 0>.

Note that these attributes are proprietary and not part of the HTML 4.01 specifications. (HTML 4.01 does define the FRAMEBORDER attribute for the FRAME element, but not for the FRAMESET element.) Also, removing the border around a frame makes it difficult to resize it, as this border is also used in most GUIs to change the size of the frame.

How can I specify background images?

With HTML, you can suggest a background image with the BACKGROUND attribute of the BODY element. Here is an example:

<body background="imagefile.gif' bgcolor="#ffffff' text="4000000" link="4000Off" vlink="#800080" alink="#000080">

If you specify a background image, you should also specify text, link, and background colors since the reader’s default colors may not provide adequate contrast against your background image. The background color may be used by those not using your background image. Authors should not rely on the specified background image since browsers allow their users to disable image loading or to override document-specified backgrounds.

Is it possible to make the HTML source not viewable?

In short, there is no real method or script for making standard HTML source code not viewable. You may consider doing any of the below if they are concerned about your source code.

Thus, the compilation of these questions includes some of the major points that can be asked during an interview. The HTML interviewers generally check the base knowledge of a candidate, which can be gained by practicing these questions prior interview.

So if you have finally found your dream job in HTML coder/or developer but are wondering how to crack the HTML Interview and what could be the probable HTML Interview Questions. Every interview is different and the scope of a job is different too. Hope above assist you to get a dream Job. Keep Learn.