Top 49 Html+xhtml Interview Questions You Must Prepare 06.Dec.2023

Using example I will show you in XHTML every attribute must have a value.
Example in HTML:
<ol compact> <input type="radio" name="title" value="decline" checked>decline</input>
Below, I write a same example in XHTML. <ol compact="compact" > <input type="radio" name="title" value="decline" checked="checked">decline</input> In this we assign value compact, checked to element compact and checked.

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 submit button (i.e., an <INPUT TYPE="submit" …> element),
  •  form data elements (e.g., <INPUT>, <TEXTAREA>, and <SELECT>) as needed, and
  •  additional markup (e.g., identifying data elements, presenting instructions) as needed.

DOCTYPE is stands for Document Type Declaration.In an HTML every HTML document is started with DOCTYPE declaration.It may be differ for different versions of HTML.DOCTYPE is used only bySGML tools like as HTML validator.
Example of Document Type Declaration in HTML 4 are,
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "">

Using Submit Button we can sends the form to the server and Action Attribute is specified that which file we send.
<form name="input" action="submit_form.php"
method="get"><input type="hidden" name="phpMyAdmin" value="f43d4e0b88acea2d2a393515f6bf38f2" /><input type="hidden" name="phpMyAdmin" value="70ac9566533a2665b6597346aab7f985" />
<input type="text" name="Form">
<input type="submit" value="Submit">
When we click the sumbit button web page than the submit_form is send to the server.

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 to emulate older, buggy browsers.

There are 77 tags defined in XHTML 1.0:

a abbr acronym address area b base bdo big blockquote body br button caption cite code col colgroup dd del dfn div dl dt em fieldset form h1 h2 h3 h4 h5 h6 head hr html i img input ins kbd label legend li link map meta noscript object ol optgroup option p param pre q samp script select small span strong style sub sup table tbody td textarea tfoot th thead title tr tt ul var.

XHTML is not very different from HTML 4.01, so bringing your code up to the 4.01 standard is a good start. In addition, you should start NOW to write your HTML code in lowercase letters. 

The Most Important Differences:

  •  XHTML elements must be properly nested
  •  XHTML documents must be well-formed
  •  Tag names must be in lowercase
  •  All XHTML elements must be closed

Yes, In XHTML we can insert only certain tags inside other tags. Example:
<ol> Some my favorite flowers are: 
and my most favorite flower is: 
<li>red rose</li> </ol> 
In the above example we insert the paragraph between 
<li> tag.It's wrong. In case of XHTML our example looks like that, becomes <p>
Some my favorite flowers are:</p> <ol>
<li>red rose</li>

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 traction) in response to a single form submission.

Yes, XHTML element names are case sensitive. All element names must be written in lower case letters. Here are some valid and invalid XHTML element names:

  • Valid name.
  • Invalid name, must use lower case letters.
  • Invalid name, not defined by XHTML specification.
  • Invalid name, must use lower case letters.

Note to HTML document authors: HTML element names are not case sensitive. But XHTML element names are case sensitive. If you are converting existing HTML documents to XHTML documents, you will get a lots of syntax errors about upper case letters used in HTML tags.

In XHTML tags may not be overlapped.
Example: <em> emphasized text and <b>bold </em>text</b> We can use above example in XHTML like that, <em>emphasized text </em> is <b>bold text</b>

"Hello World" Web page code looks like this:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tritional//EN"
<html xml:lang="en" lang="en" xmlns="">
<title>Hello World</title>
<p>My first Web page.</p>

  • to be able to take advantage of new coding techniques
  • problems with the earlier versions have been fixed.

XHTML is a fairly close copy of HTML 4.01.

Extensibility : Under HTML, the addition of a new group of elements requires alteration of the entire DTD. XML greatly eases the integration of new element collections as it is a subset of SGML itself and specifies it's own DTD.

Portability : By the year 2002 as much as 75% of Internet access could be carried out on non-PC platforms such as palm computers, televisions, fridges, automobiles, telephones, etc. In most cases these devices will not have the computing power of a desktop computer, and will not be designed to accommodate ill-formed HTML as do current browsers.

Currently, the Netscape browser helps greatly for testing web pages by displaying blank or broken pages when it comes across sloppy coding. IE is the most forgiving browser and will show almost any page no matter the extent of coding errors. While HTML itself isn't completely lacking in extensibility or portability but the evolution of it has been extremely slow compared to the pace of Internet development. This fuels the problems encountered trying to make your pages work on a wide range of browsers and platforms. XHTML will help to remedy those problems.

XHTML validation is the process of validating XHTML document with w3c’s validator

The following are the reasons for why XTML is better than HTML:

  • XHTML uses style sheets instead of font, color and alignment tags of HTML.
  • XHTML allows to style sheets and scripts embedding in CDATA section.
  • XML of XHTML eases the integration of new elements as subsets of SGML.
  • Portable – Non-pc platforms can be accessed with XHTML.

Most of XHML elements allow you to specify contents. But there are some XHTML elements that do not allow any contents. If an XHTML element does allow element content, you need to enter the content between the opening tag and the closing tag.
Here are some good examples of XHTML elements with contents:

  •  <title>My First XHTML Document</title>
  •  <p>A very long paragraph…</p>
  •  <h1>XHTML Tutorials by questions­</h1>


As XHTML is an XML application, you will benefit from developments in the XML world. For example XML tools such as editors, converters, browsers, etc. can be used with XHTML resources. In addition there are developments to the XML family of protocols and formats which will provide additional functionality for XHTML.

Many times we have require index.htm / document because it is a standard for the host-server to look for the document and deploy it.Default document to be displayed in the web.

HTTP (Hyper­Text Trfer Protocol) is an Internet communication protocol, that allows a viewer’s computer talking to a publisher’s computer to fetch XHTML documents. The viewer’s computer issues a HTTP request message to the publisher computer first. Then the publisher returns a HTTP response message back to the viewer’s computer with the requested XHTML document included in the message.

CSS (Cascading Style Sheets) is a technical specification that allows XHTML document authors to attach formatting style sheets to XHTML documents. When XHTML documents are viewed as Web pages through Web browsers, the attached style sheets will alter the default style sheets embedded in browsers.

  • The XHTML modularization model defines the modules of XHTML.
  • XHTML is a simple, but large language. XHTML contains most of the functionality a web developer will need.
  • For some purposes XHTML is too large and complex, and for other purposes it is much too simple.
  • By splitting XHTML into modules, the W3C (World Wide web Consortium) has created small and well-defined sets of XHTML elements that can be used separately for simple devices as well as combined with other XML standards into larger and more complex applications.

An application may wish to support only a subset of XHTML. For example a mobile phone, an Internet TV or even a Web-aware cooker may only require a subset of XHTML. Also modularity makes it easier to deploy new developments.

NO! XHTML still lacks semantics. Ideally your resources should be stored in an appropriate XML format. XSLT can then be used to convert the resources to XHTML (for Web browsers), WML (for mobile phones), etc. XHTML is a useful intermediate stage.

Since XML and HTML are derived from SGML they are similar, but have the following differences:
@XML is case-sensitive.
@XML must have quotes (single or double) around attributes.
@Most interpreters of HTML are very forgiving about missing end tags – XML parses are not.
@Comments start with <– and end with –>. Inside a comment, "–" may not appear. Although this is fine in html, it confuses xml parsers.

The Web is a publisher technology based on the Internet to allow publishers to publish hyper linked documents to be viewed by Internet users. XHTML is the next generation language that used to compose those hyper linked documents. In another word, XHTML is the technical language that controls Web page contents and hyper links.

The eGroups XHTML-L Web site provides links to XHTML tools, including conversion tools and editors. A couple of free tools are available (HTML-Kit, 1st Page 2000). Mozquito Factory appears to be the first licensed package on the market. You can expect the usual suspects (Microsoft, Dreamweaver, etc) to bring out new versions of their products with XHTML support.

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.

XHTML was developed by W3C HTML Working Group with Steven Pemberton as the group chair.

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.


<ol type=1>
<ol type="1">
<ol type='1'>

Serving XHTML with a MIME type of text/html is wrong.

The whole point of XHTML is that it’s XML so that you can benefit from namespaces and the like.

In particular, ‘text/html’ is NOT suitable for XHTML Family document types that adds elements and attributes from foreign namespaces, such as XHTML+MathML [XHTML+MathML].

Two choices:
@XHTML 1.0 served as application/xhtml+xml to conforming UAs, and text/html to Internet Explorer
@HTML 4.01, served as text/html 
XHTML 1.1 is not an option because it mandates a MIME type of application/xhtml+xml which is incompatible with Internet Explorer

  • The decomposition of XHTML and by reference HTML into a group of modules that are abstract to provide modularity is known as XHTML modularization. These modules are utilized in the XML document type definition language. The rules needed to define the abstract model uses XML DTD.
  • Modularization of XHTML refers to specify well defined set of XHTML elements which can be compiled and extended by the XHTML document developers, other XML standards specifications.
  • Modularization of XTML acts as a me for the designers of product for specifying the elements that supports a specific devise by using standard building blocks and standard methods for building blocks usage. The content community gets “points of conformance” by using these modules.

I have display the list of some tags that we used in HTML table.These tags are:

  • <table>   :  This is started tag of table.All other table tags works inside this tag.
  • <th>       : This is used to write header on table.
  • <tr>        : This is used to create row on table.
  • <td>     This is used to create table cells.
  • <caption> : This is specifies the table caption.
  • <colgroup> : Specifies the group of columns in table.
  • <col>     :  Using then we can set the attribute value for one or more columns in table.
  • <thead>  : This is used to set table head.
  • <tbody>  : This is used to set table body.
  • <tfoot>  : This is used to set table border.

  • HTML validators check HTML documents against a formal definition of HTML syntax and then output a list of errors. Validation is important to give the best chance of correctness on unknown browsers (both existing browsers that you haven't seen and future browsers that haven't been written yet).
  • HTML checkers (linters) are also useful. These programs check documents for specific problems, including some caused by invalid markup and others caused by common browser bugs. Checkers may pass some invalid documents, and they may fail some valid ones.
  • All validators are functionally equivalent; while their reporting styles may vary, they will find the same errors given identical input. Different checkers are programmed to look for different problems, so their reports will vary significantly from each other. Also, some programs that are called validators (e.g. the "CSE HTML Validator") are really linters/checkers. They are still useful, but they should not be confused with real HTML validators.
  • When checking a site for errors for the first time, it is often useful to identify common problems that occur repeatedly in your markup. Fix these problems everywhere they occur (with an automated process if possible), and then go back to identify and fix the remaining problems.
  • Link checkers follow all the links on a site and report which ones are no longer functioning. CSS checkers report problems with CSS style sheets.

If we want to convert HTML pages into XHTML than you have to insert some lines at the starting of document. <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tritional//EN" "">
<html xmlns="" xml:lang="en" lang="en">

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.

The basic tool you need to write XHTML documents is any text editor, like notepad on Windows system, or vi on Unix system.If you are looking for some advanced tools to help you writing XHTML documents, you can select any one from the following three categories of XHTML editors:

  •  Text based editor - Allows you to work on the text version of the XHTML document.
  •  WYSIWYG editor - Allows you to work on the rendered version of the XHTML document.
  •  Browser based editor - A WYSIWYG editor integrated into an existing Web browser.

XHTML editors can also be loaded with additional functionalities to allow you work with other Web technologies like CSS and JavaScript, or publish the XHTML documents to your Web server.


SGML (Standard Generalized Markup Language) is a metalanguage in which one can define markup languages, like HTML, for documents. SGML is a descendant of IBM’s Generalized Markup Language (GML), developed in the 1960s by Charles Goldfarb, Edward Mosher and Raymond Lorie (whose surname initials also happen to be GML). XHTML is not directly related to SGML. But it is indirectly to SGML through HTML.

Rather than manually creating WML markup, XSLT will enable XHTML documents to be automatically converted to WML.

We use <table> tag to create the table in HTML. After creating an table we use <tr> tag to create the rows.And use <td> to create data cell on each row.These cell can store images,text,tables,list etc.
Basic syntax to create an Table are given below:
<table border="1">
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
<td>row 1, cell 3</td>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
<td>row 2, cell 3</td>

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 anything about HTML until after it parses the HTML DTD you specified. This should give you some idea of my skill level with HTML.

We use SPAN by using <SPAN> tag in HTML.Syntax:<SPAN>…………</SPAN>Used to highlightthe any color text, for adding colored text, for adding background image to text. SPAN not a cause of line break. It delimits text and using them we can use style to the 'elemental' region without any break in Text.
<span style="color:#FF0000;">
In this page we use span.

Some main advantage of XHTML are given below:
1.In XHTML we can use mixed namespaces. on XHTML is much simple than HTML.
3.When your document is not well formed than it will immediately informed to you due to an error from your UA in XHTML.

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.

  • Most of the web pages contain bad HTML Combines the strengths of both XML and HTML.
  • XHTML is strict in defining the tags, like Properly nested elements.
  • All elements must always be closed.
  • All elements must be written in lower case. 
  • Every XHTML document must have one root element.

AJAX requests should use an HTTP GET request when retrieving data where the data will not change for a given request URL. An HTTP POST should be used when state is updated on the server. This is in line with HTTP idempotency recommendations and is highly recommended for a consistent web application architecture.

XHTML stands for Extensible Hypertext Markup Language. It is a combination of XML and HTML capabilities. XHTML can be viewed as intersection of HTML and XML in many aspects.

An element attribute is a predefined property about this element. Element attributes allows you to provide additional information to the element. Most XHTML elements have some common attributes. But many XHTML elements have their own specific attributes.
Here are some good examples of element attributes:

  •  <br/> – No attribute.
  •  <script type=”text/javascript”> – One attribute: “type”.
  •  <p class=”sideNote”> – One attribute: “class”.
  •  <meta name=”Author” content=”­”/> – Two attributes: <img src=”ggl.gif” alt=”ggl”/> – Two attributes: “src” and “alt”. 

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.