Extras / HTML Mistakes < you are here. | < share |
Here is a list of mistakes made in HTML code.
Common Mistakes: Spelling | Speech Marks | Tags
Specific Tag Mistakes: Tables | Pictures | Headings
Other Code Mistakes: HTML Character Codes
You can see a list of the most common mistakes here, or you can check your HTML code with our code checker here.
correct spelling | incorrect spelling |
---|---|
align | aline |
valign | valine |
US spelling | UK spelling |
---|---|
bgcolor | bgcolour |
center | centre |
color | colour |
meter | metre |
Always put speech marks round the values of a parameter.
For example in bgcolor="red", "red" is the value and needs speech marks round it.
Please also make sure:
- you use straight speech marks
- you use double speech marks
You can use double speech marks(") or single ones(') - HTML doesn't mind.
However, it's better to use double speech marks all the way through.
Most parameters are in the format attribute="value". For example, <button bgcolor="red" > makes a red button.
For some parameters, though, you can just use the attribute. For example <button disabled > makes a button that is not enabled (doesn't work).
However, it is better to use the standard format (attribute="value") with these attributes too.
So, <button disabled > should be <button disabled="disabled" >
(the value is always the attribute name repeated)
Here is a list of attributes which can be used alone, but should not be:
attribute | used in tags | incorrect example | correct example | description |
---|---|---|---|---|
disabled | button, input, option, optgroup, select, textarea | <button disabled > | <button disabled="disabled" > | disables controls |
checked | input | <input type="checkbox" checked > | <input type="checkbox" checked="checked" > | puts a check in a checkbox |
noshade | hr | <hr noshade /> | <hr noshade="noshade" /> | prevents shading in a line |
nowrap | td, th | <td nowrap > | <td nowrap="nowrap"> | stops text being wrapped round onto a new line in a table cell or header |
readonly | input, textarea | <textarea readonly > | <textarea readonly="readonly" > | prevents people writing in boxes |
selected | input | <input type="checkbox" selected > | <input type="checkbox" selected="selected" > | selects a value in a list |
HTML can be written in UPPERCASE or lowercase.
However, you should write it in lowercase to make sure it can be read by all browsers.
So, <H1> should be <h1>.
Tags can be written all on one line or on separate lines, or with spaces - HTML doesn't mind.
<table> <tr> <td>A1</td><td bgcolor="red" rowspan="2">A2</td> </tr> <tr> <td>B1</td> </tr> <tr> <td>C1</td> </tr> </table> |
|
<table> <tr> <i><td>Hello</td></i> </tr> </table> |
|
|
|
You should include the alt parameter in an <img> tag.
alt tells the computer text to display if it can't find your picture.
You should put the heading tags in order on the page, with h1 then h2 then h3 like this:
<h1>Heading 1</h1>
<h2>Heading 2</h2> <h3>Heading 3</h3> |
Heading 1Heading 2Heading 3 |
Don't put heading tags out of order (it will look strange and may not work in some browsers).
For example, this is bad:
<h1>Heading 1</h1>
<h3>Heading 3</h3> <h2>Heading 2</h2> |
Heading 1Heading 3Heading 2 |
Sign | HTML Code | Description |
| blank space | |
& | & | Ampersand |
“ | “ | Opening Double Quotes |
” | ” | Closing Double Quotes |
‘ | ‘ | Opening Single Quote Mark |
’ | ’ | Closing Single Quote Mark |
– | – | en-dash |
— | — | em-dash |
> | > | greater than |
< | < | less than |