Wednesday, October 26, 2011

More CSS

Block-level "div" element
  • for applying style to a block of content
  • separates out the parts of the document.
  • people today say not to use div tags because they are becoming more specific, but a lot aren't used yet, so you have to choose what you want.
In-line element "span"
  • Used to apply a style to an in-line part of the document (like within the text of the document)
  • cool
Parts of a style:
  • Selector: which elements in HTML the style will apply to
  • property: identifies what property of the element(s) that the style is applied to will be affected.
  • value: sets the property to a particular value.
div#content{
color: white;
}

Comments and White space
  • To start a comment in a CSS file: /*
  • To end a comment in a CSS file: */
  • You can put a comment anywhere in the document and it will be parsed out of the functioning CSS text
  • Whitespace is typically ignored in CSS, but you can add it for organization.
Statements
  • "{" indicates the CSS block. Every style has a selector and a block.
  • A block has many statements. Each statement is terminated by a semi-colon. ";" If you forget the semicolon, the other statements will not be understood by CSS parser, unless it's at the end of a block.
Tag, Class, and ID selectors
  • Use class selectors if you think you'll use the style again.
  • Use and ID selector if the style is specific to a particular element.
Psuedo-selectors
  • i.e., visited state, unvisited states
  • tag selector, link state = a:link
  • tag selector, visited state = a:visited
  • tag selector, hover state = a:hover
  • to get rid of underline= a { text-decoration: none; }
  • You can also underline it when you hover over it
  • You can also do specific things for the first line of a paragraph
Managing font attributes
  • font-weight
  • font-family
  • font-style
Positioning Content
  • Relative positioning is for creating a reference point for absolute positioning.
  • z index property: the third dimension--letting things go behind or in front.
  • z-index: -1; (0 is the lowest number, so whatever is level 0 gets put in front)

No comments: