Moderator
From: Yorkshire, UK
Registered: 2006-08-19
Posts: 2818
I've been thanked 81 times.
Offline
This post is mainly for my reference as I keep loosing these two lines of code
Quirks mode is a bug in IE.
If a browser cannot find a valid document type definition then it doesn't know how the author interned it to be used/displayed.
IE makes a pretty poor guess and most of the time gets it wrong, this is known as quirks mode. Adding a correct DTD will make IE behave better.
I always code my pages in XHTML, so I use these two lines at that top of all the html pages
Code: html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
I also use UTF-8, in the header section i put
Code: html
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
Given that it is XHTML all tags need to be properly nested and properly closed, single entity tags like img, br, input, link, meta and hr can 'self close' by adding a / before the >
eg
Code: html
<img src='....' />
<br />
<input type='text' name='...' />
<link type='text/css' rel='stylesheet' href='........' />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<hr />
Put all this together and you will fix most cross browser CSS layout issues you come across
Member
From: west yorkshire
Registered: 2007-10-09
Posts: 166
I've been thanked 8 times.
Offline
your post has prompted a question
what is the difference between XHTML 1.0 Transitional and XHTML 1.0 Strict and when should each be used
appreciate that this might be a small question with a large answer - know that some attributes validate in one and not the other etc
Moderator
From: Yorkshire, UK
Registered: 2006-08-19
Posts: 2818
I've been thanked 81 times.
Offline
Good question.
I don't know for sure but my guess is the following:
XHTML rules will be different from HTML
some old rules will no longer be allowed
some rules will be re-written
some rules will be new
Strict must follow the rules exactly, for example all tags closed and nested and some attributes are not allowed (including target='new')
loose, i expect, allows some of the formatting rules to be included (eg improper nesting and open tags)
Transitional may be somewhere in between
You've prompted me to go and look it up - back soon.............
Moderator
From: Yorkshire, UK
Registered: 2006-08-19
Posts: 2818
I've been thanked 81 times.
Offline
See http://htmlhelp.com/tools/validator/doctype.html
also:
wikipedia wrote:
* XHTML 1.0 Strict is the equivalent to strict HTML 4.01, and includes elements and attributes that have not been marked deprecated in the HTML 4.01 specification.
* XHTML 1.0 Transitional is the equivalent of HTML 4.01 Transitional, and includes the presentational elements (such as center, font and strike) excluded from the strict version.
* XHTML 1.0 Frameset is the equivalent of HTML 4.01 Frameset, and allows for the definition of frameset documents—a common Web feature in the late 1990s.
It appears that strict has removed all tags that only focus on presentation, eg
<center>
<font>
<strike>
and i expect,
<b>
<i>
<u>
yet Transitional allows these.
with strict you would have to use css to make some text centered or bolded
eg
Code: html
some text and i want to make <b>this bold</b>
Becomes
Code: html
some text and i want to make <span style='font-weight:900;'>this bold</span>
EDIT
Last edited by Northie (2008-08-14 09:40:15)wikipedia wrote:
The remaining presentational elements i, b and tt, still allowed in XHTML 1.x (even Strict), will be absent from XHTML 2.0.
Member
From: San Antonio, TX
Registered: 2006-08-07
Posts: 510
I've been thanked 27 times.
Offline
Also, XHTML 1.1 only comes in the STRICT flavor. The one difference keeping me from going XHTML strict is that the target attribute of the anchor (<a>) tag isn't allowed, and for some of my links I prefer to open them in another tab/window so that the user doesn't leave our site when opening a link. There was some discussion on putting target back into the specification, but I don't know if or when it will actually happen. There is the alternative of using javascript to open a new window, but that just seems messy to me.
Last edited by Steven_A_S (2008-08-14 09:56:22)Member
From: west yorkshire
Registered: 2007-10-09
Posts: 166
I've been thanked 8 times.
Offline
I have also found that using .........co.uk/" target="_blank"> and <input..... does not validate in strict but does in Transitional
.... HTML 4.01 Transitional. HTML 4 Transitional includes all elements and attributes of HTML 4 Strict but adds presentational attributes, deprecated elements, and link targets.
therefore why would anyone use Strict?
Moderator
From: Yorkshire, UK
Registered: 2006-08-19
Posts: 2818
I've been thanked 81 times.
Offline

Steven_A_S wrote:
The one difference keeping me from going XHTML strict is that the target attribute of the anchor (<a>) tag isn't allowed,.....
if you're using jquery, do this
Code: javascript
//assuming you use <a href='....' class='open_new'>......</a>
//instead of <a href='....' target='_blank'>......</a>
$(function(){
$("a.open_new").attr('target','_blank');
});
Moderator
From: Yorkshire, UK
Registered: 2006-08-19
Posts: 2818
I've been thanked 81 times.
Offline
I've found another issue with xHTML strict:
some elements must be nested inside a defined set of parent elements,
for example
Code: html
<form action='/' method='get' name='myForm'>
<input type='submit' value='Go!' />
</form>
will fail due to these points
'name' is not an allowed attribute of a form
input is not allowed to be a first child of a form, it must be inside a fieldset, or some other block level element that was listed on the w3 validation page
Ok, so this helps the page become more semantic but given that xHTML is supposed to be xml based it seems somewhat backwards to ban/limit/control attributes. xml is extensible, so why is xHTML (extensible hyper-text markup language) not ?
Member
From: San Antonio, TX
Registered: 2006-08-07
Posts: 510
I've been thanked 27 times.
Offline
Use the 'id' attribute instead of 'name'. As for the other, it appears they're just trying to reinforce a good design practice - wrapping form elements in formattable containers.
Moderator
From: Yorkshire, UK
Registered: 2006-08-19
Posts: 2818
I've been thanked 81 times.
Offline
Steven_A_S wrote:
Use the 'id' attribute instead of 'name'. As for the other, it appears they're just trying to reinforce a good design practice - wrapping form elements in formattable containers.
I've got nothing against using the id, instead of the name but i just feel that the name attribute is something that all (most) elements should be allowed to have - including form
Unfortunately we can't use x-path style css selectors yet.......... 
| Never |


