HTML - CSS - DOM Notes

Skip to end of metadata
Go to start of metadata

HTML

General

  • The id attribute begin with a letter or underscore, followed by letters, digits and underscores.
  • If working with javascript, the id attribute must have no blanks or hyphens.
  • DOCTYPE followed by xmlns is required.
  • All tags in lower case.
  • All DOM hooks must be lowercase, i.e. onmouseover=...
  • All attributes must be quoted, i.e. height="100".
  • Encode greater than and less than into entities.
  • Margin, padding, border all use the 'clock face' for position.

Best Practices

  • Always use left align. Ie6 bug.
  • Using line-height (set to max height of element) rather then vertical-align to center content.
  • Use <strong></strong> rather then <b></b>.
  • Use <em></em> rather then <i></i>.
  • Close empty tags, i.e. <br /> and <img src="foo.png" />
  • Include onkeypress with onclick for non mouse users.
  • Where javascript is used for navigation, provide a <noscript> option containing navigattion links

Placeholder text

lorem ipsum

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Examples

  • How to horizontally place three divs:

Javascript

document.getElementById()

  • Available in all modern browsers, used to target id.

disable or enable onclick

  • On IE6, onchange does not behave like onclick, as a result, use onclick.

Questions

  • Is there a problem using ids with illegal characters (specifically the space) for wrapper id in out template.
  • What DOCTYPE should be used?
Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.