HTML CSS

  • An attribute is extra information to define elements such that <tag attribute="information">
  • The id attribute is a unique name for an element in the current page
  • Document Object Model (DOM)
    • A cross-platform and language-independent interface that treats an HTML document as a tree structure of node objects representing a part of the document
    • Every element in the DOM is a node
  • and are generic HTML container widgets
    • The div tag is a block-level element used for associating and grouping together nested elements, used very often, it's like SKContainer
    • The span tag is an inline element used for associating and grouping together nested elements, often used for styling
  • A CSS rule has three parts
    • selector
    • declaration block
    • one or more properties with values
  • A pattern to select (or find) elements in the DOM
    • Basic selectors
      • div { … } select by tag type
      • .foo { … } select by class name
      • #a { … } select by element id attribute
      • [type="text"] { … } select elements matching attribute value
    • Hierarchical selectors
      • div > div { … } select child elements by parent-child relationship
      • div div { … } select child elements by descendant relationship
    • Pseudo class selectors (there are many more …)
      • :first-child select first child
      • :hover select when mouse is over element
    • Combining selectors
      • div#a { … } select elements matching all selectors
      • div, #a { … } select elements matching at least one selector
  • CSS rule precedence (cascade) determines which style applies when multiple rules match
    • Who specified:
      • user-agent (browser default) < author (your CSS) < user (custom styles)
    • Where specified:
      • external stylesheet <