Three types of code, and how they interact

XHTML CSS JavaScript

XHTML consists of content elements on the page:

  • headings
  • paragraphs
  • lists
  • links
  • buttons
  • textboxes
  • [...]

CSS controls how those elements are displayed:

  • colours
  • size
  • position
  • text style
  • alignment
  • borders
  • visibility
  • [...]

JavaScript changes and manipulates the elements on the page, by changing the CSS and XHTML to:

  • hide and show things
  • move things
  • change the colour of things
  • change the text of things
  • check answers
  • calculate scores
  • [...]