Electric Type

Multimedia

About Us

News

Help

XHTML Overview

Page 4 — Attributes, Arguments and Anchors

In XHTML 1.0, all attributes must have arguments, and all arguments must be in double quotes. Even if the argument is simply a number or a percentage, you still need to place it between double quotes.

For example,

       <img src="icon.png" height=10 width=10 />

is not a valid XHTML fragment. Simply adding quotes:

       <img src="icon.png" height="10" width="10" />

would make it valid.

Even in cases where the attribute only has one possible argument, you must specify the argument. It sounds twisty, so let me show you an example.

In HTML you can specify a text area to be read-only by typing:

       <textarea name="text" rows="20" cols="80" readonly>
       text text text
       </textarea>

To make this valid in XHTML, you would have to alter it to read:

       <textarea name="text" rows="20" cols="80" readonly="readonly">
       text text text
       </textarea>

It does seem a bit silly, but it works!

Another change under XHTML is the use of page anchors. Even though this change will not become standard until versions of XHTML later than 1.0, you should begin including the XHTML tag attributes in order to ensure that your pages are compliant in the future. Later versions of XHTML are going to drop the "name=" attribute in page anchors. Instead, one should use the "id=" attribute to name an anchor that's referenced by a "#" in the URL.

Currently, most browsers only understand the "name=" argument, so until the browsers all catch up, simply use both of the attributes in your anchors, like this:

       <a id="something" name="something">Something Else </a>

next page»


Dynamic HTML  

Frames  

HTML Basics  

Stylesheets  

Tables  

XML  

Javascript  

Database Connections  

Intro To Perl  

HTML 4.0  

User Blogs

Screen Shots

Latest Updates

Contact Us

Valid HTML 4.01!
Valid CSS!

Breadcrumb

© ElectricType
Maintained by My-Hosts.com
Site map | Copyright | Disclaimer
Privacy policy | Acceptable Use Policy
Legal information.