Supported by :   My Law Forms Ltd. - Company Formations, Deed polls and Tenancy Agreements

You are currently browsing the archives for the XHTML tips category.

12 Ways to Make Your Web Pages Better

Due to the nature of the Internet, people may be viewing your web page with many different types of browsers such as a text-only browser, a voice browser, or a cell phone; they may be clicking through your site without a mouse, or keyboard, or they may be browsing hands-free. Some people may be accessing […]

Why Use Style Sheets?

Several years ago a major push was made to begin separating the presentational aspects of a website from the structural aspects of it through the use of Cascading Style Sheets (CSS). By working towards this separation a website designer can make her job easier in many ways.

Don’t Use the Font Tag

A clear sign of an amateur web designer is their use of the font tag. This tag was deprecated in HTML 4.01 which means it should no longer be used. Not only does it clutter up your documents, but it makes the look and feel of your website more difficult to change.

Internet Media Type - Specify Character Encoding

When creating an XHTML document you will need to specify the character encoding Internet Media Type, or Content-Type of the document. The W3C recommends that XHTML documents be sent as type text/html or application/xhtml+xml. This should be set by the webserver. If you cannot change the web server settings however, you can also specify this […]

ID vs Class

One common question when working with XHTML and CSS is whether to use the id or class attribute on an element. There are several rules that you should consider when using either attribute.

Special Characters and CDATA

Special Characters and CDATA
In XHTML the < and & are special characters that the XML processor will interpret as the start of markup. You’ll usually find these characters in Javascript such as this simple if statement:

XHTML Formatting - tag attributes

Quote everything
In order to become a ninja coder you will have to pass the quote test. The rule is simple: quote all attribute values, period.
Here’s a GOOD example:
<a href=“http://yoursite.com”>My Site</a>

XHTML Formatting - closing tags

Close those elements
When you’re creating valid xHTML you’ll need to make sure that you always close your elements properly. When your element has some data in it make sure you add an end tag directly after your data. Consider the following examples:

XHTML Formatting - well formed XML

The good thing, and sometimes the bad thing, about xHTML is that it requires strict attention to well-formedness and element and attribute capitalization. Here’s a quick guide that will make it easy for you to remember what to do and what not to do when you’re marking up a document.

Why use XHTML?

XHTML is the defacto web standard markup language when it comes to creating websites … at least for now. It’s a development of the old HTML 4 standard which is compliant with the newer XML standard and is transitional in many ways. When you create your website using valid XHTML you create a website that […]