Valid (X)HTML
I went to a lots of fan sites, most of then does't have valid (X)HTML. According to my reserach, I found some common errors:
Error |
How to solve |
Ampersand in URL/texts |
use & instead of just & |
Double quotes in URL/texts |
use " instead of just " |
Self-closed tags |
use <br /> or <img src='' alt='' /> instead of <br > or <img src='' alt='' > |
Images(and many other replaced elements) missing alt attribute |
add alt attribute to images(read more) |
< and/or > in <script>s and <style>s |
Add <!-- and --> on the first/last comments to treat scripts/styles as comments.(read more)
Example:
<script type='text/javascript'>
//<!--
if (a < b)
{
return true;
}
//-->
</script>
<style type='text/css'>
/*<!--*/
body > p
{
font-family: Consolas,monospace;
}
/*-->*/
</style>
|
Missing type attribute in <script>s and <style>s |
For JavaScript tags, add type='text/javascript' in attributtes and remove language='JavaScript'. For CSS tags, add the type='text/css' attributes.
Here's what it should look like:
<script type='text/javascript'>
//<!--
if (a < b)
{
return true;
}
//-->
</script>
<style type='text/css'>
/*<!--*/
body > p
{
font-family: Consolas,monospace;
}
/*-->*/
</style>
|
There may be more, I found there's a site from W3C has more tips:
http://www.w3.org/QA/Tips/
|