banner
Welcome to HTML.co.uk, the number one resource for all news, information, and happenings regarding HTML.

Updates: HTML.co.uk has just been relaunched. Subscribe to our RSS Feed to stay on top of HTML news and techniques.
Jul
16th

Classification of HTML

Author: Editor | Files under HTML Tutorials
Tags for this article: , , , , ,

HTML can be classified into two categories namely SGML based HTML (traditional) pitted against XML based HTML (also called XHTML) and the second one being a strict versus transitional versus frameset. In this article, the former has been described in detail.

One notable difference between the traditional version and XHTML is the technical distinction between the two of them. However, Inspite of all the modifications being done, the root element name “HTML” has been kept the same. The area which requires loads of effort is the one where the limitations of XML start showing in comparison to the more complex SGML inspite of the W3C intended HTML 4.01 being identical to XHTML 1.0. Due to the similarity quotient between HTML and XHTML, they are documented in parallel at many times.

The difference between an XHTML 1.0 document and an HTML 4.01 document is mostly syntactic in each of the corresponding DTDs except for the different opening declarations applicable for the document. There are many shortcuts which XHTML does not allow but HTML allows because of the underlying syntax. Be it elements with optional opening or closing tags, empty elements not having an end tag, all these are examples of the shortcuts that a user can take advantage of in HTML. HTML requires all elements to have an opening tag or a closing tag.

After contemplating on the whole process, the developers of XHTML have also come out with a shortcut. The opening and closing of an HTML tag has to be done within the same tag but a slash (/) can be added before the closing of the tag. For demonstration of the concept, let us take this example: <avi/>, where “<” is the opening tag and “>” the closing tag, “avi” is a fictitious HTML tag and as mentioned above, the slash (/) comes before the tag is closed.

To properly understand the minute differences between HTML and XHTML, the tips listed below need to be kept in mind:

. XHTML makes use of XML’s built in language defining functionality attribute. The language for an element should be specified with a lang attribute rather than the XHTML attribute.
. The XML namespace has to be removed as HTML does not have a provision for namespaces.
. The document type declaration has to be changed from XHTML 1.0 to HTML 4.01.
. The empty-element syntax of an XML has to be developed into a style empty element of an HTML.

A technically well constructed XHTML document will always follow all the syntax requirements of XML. The structure of a document is thoroughly described by the content of XHTML and legitimate documents will religiously follow its specified data.

To migrate easily between HTML and XHTML, several conventions have been recommended by the W3C and by meticulously following these guidelines, a user will be able to easily interpret the document as HTML or XHTML. The XHTML 1.0 documents that have been made compatible in this way are permitted by the W3C to be served either as HTML or as XHTML.


May
12th

The Address Base and Window Destination Base

Author: Editor | Files under HTML Tutorials
Tags for this article: , , , ,

You can write the internet wide and unique URI inside an HTML file loaded onto an internet server. A web browser that processes this information can then better access referenced or linked files. The base defined here functions as a suitable model for links to other HTML files or references to graphics and multimedia.

An Example:

<head>
<base href= “http://www.html.co.uk/”>
</head>

Explanation:

The file base element consists of <base href= …> and the exact file URI.

If graphics such as the following exist in the file:
<img src= “/src/logo.gif”>
The web browser then determines an absolute URI for this graphic:
<img src= “http://www.html.co.uk/src/logo.gif”>.

Take Note:

If it is important for you that your project remains easily transferable to other server computers in different directory structures, then you should refrain from defining an address base. Because with an element linking to a unique internet address, the web browser will continually attempt to load graphics and link destinations for the entered address. This makes testing a file on your local PC impossible!

On the other hand, the address base element provides a certain level of protection for the HTML illiterate who wish to save a HTML file locally or search the cache directory of their web browser. While locally accessing a HTML file, the web browser will always demand an online connection and then load the file from the address entered.

If you work in XHTML standard conform, then you must describe the base element as content less. Use the standalone tag in this form to do so: <base … />.

Window Destination Base

This element is useful in conjunction with frames, for example. It can determine for an HTML file, that is shown inside a frameset in a frame window, that all of the links within the file should be shown in a different frame window, as long as the link does not demand any other type of frame window. Because many link destinations in a file, which is shown in a frame window, actually should be displayed in a different window type, this one time element in the file header saves a lot of typing work and makes the file more manageable.

An Example:

<head>
<base target= “RightWindow”>
</head>

Explanation:

With <base target= … > you determine the default window in which the link destination should be displayed. The requirement for the above example is that the frameset is defined with window frames. You must determine the desired frame window by entering the window name with the name attribute in <base target= … >.

Instead of assigning a window name on your own, you can also use the following predetermined elements which are also useful for more than just framesets.
<base target= “_blank”> opens every link within the file in a different browser window.

<base target= “_top”> opens every link inside the file in the entire browser window and prevents all other framesets from being displayed.

<base target= “_parent”> opens every link inside the file in a upper level frameset and prevents the display of inner framesets. _parent and _top distinguish between each other when a window again contains a complete frameset.