1 / 11

CSS

Class & ID Selectors, Font and List Properties. CSS. Id Selectors. # followed by Id-name (without space) Can be used once on a page Examples: #p1 { color: #000000; } same as p#p1 { color: #000000; }. Class Selectors. . followed by Class-name (without space)

adara
Download Presentation

CSS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Class & ID Selectors, Font and List Properties CSS

  2. Id Selectors • # followed by Id-name (without space) • Can be used once on a page • Examples: • #p1 { color: #000000; } • same as • p#p1 { color: #000000; }

  3. Class Selectors • . followed by Class-name (without space) • Can be used multiple times on a page • Examples: • .pbold { font-style: bold; } • different from • p.pbold { font-style: bold; }

  4. Font Properties • font-family • font-size • font-style • font-variant • font-weight

  5. Absolute Versus Relative Size • Absolute: predefined meaning or understood real world equivalent • xx-small, x-small, small, medium, large, x-large, xx-large • cm, in, mm • pt (point = 1/72 of an inch) • pc (pica = 12 points)

  6. Absolute Versus Relative Size • Relative: based on size of something else • larger, smaller (relative to parent object) • em (appr. width of the letter “M” in a font) • ex (appr. height of the letter “x” in the font) • px (relative to display resolution) • % (relative to parent object)

  7. Font Sizes Recommendations • Avoid: pt, pc, mm, cm, in • Avoid pixels if accessibility is important (IE 5/6 have no zoom function) • Use combination of % and em • body {font-size: 76%}p {font-size: 1 em;}h1{font-size: 1.5 em;} • Please read: www.thenoodleincident.com/tutorials/box_lesson/font/index.html

  8. Font Properties • font-family • font-size • font-style • normal • italic (usually separate typeface) • oblique (normal font slanted) • font-variant • normal • small-caps • font-weight • font (shorthand property)

  9. Font Weight • normal • bold • bolder • lighter • 100, 200, 300, 400 (normal), to 900 • Browser support inconsistent, due to lack of available fonts

  10. Font Shorthand • selector { font: [ [ <'font-style'> || <'font-variant'> || <'font- weight'> ]? <'font-size'> [ / <'line-height'> ]? <'font- family'> ] } • If value is not specified  default value • Size and family must be specified • Example: • p { font: italic small-caps bold 1.5em/3em sans-serif } • h2 { font: 2em fantasy; }

  11. List Properties • list-style-type • For choosing a marker • disc, circle, square, • decimal, lower-roman, etc. • http://www.w3schools.com/css/css_reference.asp#list • list-style-position • Marker inside or outside content area • list-style-image • Images can be used as bullets • list-style (shorthand)

More Related