Some Common XHTML 1.0 Transitional syntax errors:
If your XHTML syntax errors are ONLY being caused by JavaScript, then I will not count those errors against you.
For instance, even this will cause an XHTML error, because of the capital C in onClick:
words
But because onClick is a JavaScript word, I would waive the error.
If you have another good syntax error example, or a question, please email me...
just plain wrong:
- NOT using XHTML 1.0 transitional for the doctype,
but using HTML 4.01 transitional or something else instead!
incorrect syntax:
text
forgetting to close tags by accident
correct:
text
incorrect syntax:
text
can't have p inside element h2 (p tags can't be inside heading tags)
correct:
text
text
incorrect syntax:
text
can't have h1 inside element p (heading tags can't be inside p tags)
correct:
text
text
incorrect syntax:
image tag without the alt attribute
correct:
OR
incorrect syntax: WARNING: (well, this isn't as serious,
and wouldn't cost you marks, but you should try to avoid it anyways)
forgetting the space before the final / inside the tag
correct:
incorrect syntax:
words words
---- p not allowed in content of element font (p tags can't be inside font tags)
correct:
words words
OR you could just use CSS to deal with text and fonts
incorrect syntax:
--- table not allowed in content of element font (table tags can't be inside font tags)
correct:
Notice how the font tags are within the tags, and surround the text within...
OR you could just use CSS to deal with text and fonts
incorrect syntax:
>
BBEdit says "unencoded entity of > found, but needs to be > "
(meaning, you can't have this character: > by itself in XHTML,
you have to use an escape sequence instead, like > for > or < for <)
correct:
>
incorrect syntax:
&
BBEdit says "unencoded entity of & found, but needs to be & "
(meaning, you can't have this character by itself in XHTML,
you have to use an escape sequence instead, like & for &)
HOWEVER - if the & is inside script tags as part of your JavaScript,
then DO NOT change the & - we will ignore any errors in syntax that BBEdit gives
for & symbols that are between script tags as part of correctly functioning JavaScript.
otherwise, in XHTML, correct:
&
incorrect syntax:
ANY CAPITALIZATION that is not inside "quotes" but is part of a tag
So things like
words
cause an error.
correct syntax:
words
incorrect syntax:
FFFF99
for a colour, inside a tag and inside quotes as an otherwise correct colour attribute setting
for that tag, using the hexadecimal code, but leaving off the # sign at the start
correct:
#FFFF99
incorrect syntax:
#red
for a colour, inside a tag and inside quotes as an otherwise correct colour attribute setting
for that tag, using a predefined colour name, but adding a # sign at the start
correct:
red
Common typos that cause incorrect syntax:
TYPO instead of CORRECT SPELLING:
vlign instead of valign
scr instead of src
herf instead of href
hieght instead of height
incorrect syntax:
- setting a background image using the background attribute
correct:
- No background image attribute available for XHTML -- you need to use CSS to get table background images
incorrect syntax:
---- old HTML body attributes like: leftmargin, topmargin, marginwidth, marginheight
these are not allowed in XHTML transitional
instead you are supposed to use CSS to deal with these issues,
CSS found in chapter 11 of the XHTML book (I think mainly on page 188 and 189)
|