Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSS for Community Managers

CSS for Community Managers

Part of a presentation at Coding for Community Managers on June 23, 2012. Sponsored by @UserVoice and @twilio.

Avatar for Joshua Rudd

Joshua Rudd

June 25, 2012
Tweet

Other Decks in Programming

Transcript

  1. What is CSS? HTML allows you to describe (give semantic

    meaning to) content, CSS allows you to style the presentation of that content.
  2. What is CSS? HTML allows you to describe (give semantic

    meaning to) content, CSS allows you to style the presentation of that content.
  3. What is CSS? HTML allows you to describe (give semantic

    meaning to) content, CSS allows you to style the presentation of that content.
  4. What is CSS? Before CSS, we had to use markup

    for both content and presentation. Now HTML can focus on well-formed content, while CSS lets us present that content in any number of ways.
  5. What is CSS? Before CSS, we had to use markup

    for both content and presentation. Now HTML can focus on well-formed content, while CSS lets us present that content in any number of ways. If you see HTML presentational elements like <font> or <center> (or <table> used for layout), run for the hills!
  6. What is CSS? One promise of CSS is that you

    can keep the same HTML (content) and completely change the presentation of it with different styles. Example: CSS Zen Garden
  7. What is CSS? One promise of CSS is that you

    can keep the same HTML (content) and completely change the presentation of it with different styles. Example: CSS Zen Garden
  8. What is CSS? One promise of CSS is that you

    can keep the same HTML (content) and completely change the presentation of it with different styles. Example: CSS Zen Garden
  9. What is CSS? One promise of CSS is that you

    can keep the same HTML (content) and completely change the presentation of it with different styles. Example: CSS Zen Garden
  10. What is CSS? One promise of CSS is that you

    can keep the same HTML (content) and completely change the presentation of it with different styles. Example: CSS Zen Garden
  11. What is CSS? One promise of CSS is that you

    can keep the same HTML (content) and completely change the presentation of it with different styles. Example: CSS Zen Garden
  12. What is CSS? One promise of CSS is that you

    can keep the same HTML (content) and completely change the presentation of it with different styles. Example: CSS Zen Garden
  13. Including CSS in your HTML <p style=“color: red;”> <style> p

    { color: red; } </style> Inline styles Embedded style block
  14. Including CSS in your HTML <p style=“color: red;”> <style> p

    { color: red; } </style> <link rel="stylesheet" href="example.css" type="text/css"> Inline styles Embedded style block External style sheet
  15. Including CSS in your HTML <p style=“color: red;”> <style> p

    { color: red; } </style> <link rel="stylesheet" href="example.css" type="text/css"> HTML CSS Inline styles Embedded style block External style sheet HTML CSS HTML (the CSS is in this le) <body> </body> <head> </head> <head> </head>
  16. Including CSS in your HTML <style> p { color: red;

    } </style> <link rel="stylesheet" href="example.css" type="text/css"> Inline styles Embedded style block External style sheet It’s best to avoid inline styles, but it can be quick and easy for styling one-off things. However, if you’re writing the same inline style in more than one place, you're probably doing it wrong. <p style=“color: red;”>
  17. Including CSS in your HTML <p style=“color: red;”> <link rel="stylesheet"

    href="example.css" type="text/css"> Inline styles Embedded style block External style sheet Very useful for overriding external styles on a single page. <style> p { color: red; } </style>
  18. Including CSS in your HTML <p style=“color: red;”> <style> p

    { color: red; } </style> Inline styles Embedded style block External style sheet Best when applying the same styles across multiple web pages. External stylesheets are cached by the browser (faster loading) and you can change your styles in one le instead of all les that link to it. <link rel="stylesheet" href="example.css" type="text/css">
  19. CSS Anatomy 101 CSS is made up of rules Each

    rule has two parts: Selector One or multiple declarations
  20. CSS Anatomy 101 CSS is made up of rules Each

    rule has two parts: Selector One or multiple declarations h1 { color: black; font-weight: bold; }
  21. CSS Anatomy 101 CSS is made up of rules Each

    rule has two parts: Selector One or multiple declarations h1 { color: black; font-weight: bold; }
  22. CSS Anatomy 101 CSS is made up of rules Each

    rule has two parts: Selector One or multiple declarations h1 { color: black; font-weight: bold; }
  23. CSS Anatomy 101 #ID attribute h1 { color: black; font-weight:

    bold; } .class attribute element <div id=“masthead”> <h1 class=“title”> <h1 class=“title”> Common selectors:
  24. CSS Anatomy 101 #ID attribute #masthead { color: black; font-weight:

    bold; } .class attribute element <div id=“masthead”> <h1 class=“title”> <h1 class=“title”> Common selectors:
  25. CSS Anatomy 101 #ID attribute h1 { color: black; font-weight:

    bold; } .class attribute element <div id=“masthead”> <h1 class=“title”> <h1 class=“title”> Common selectors:
  26. CSS Anatomy 101 #ID attribute .title { color: black; font-weight:

    bold; } .class attribute element <div id=“masthead”> <h1 class=“title”> <h1 class=“title”> Common selectors:
  27. CSS Anatomy 101 h1 { color: black; font-weight: bold; }

    Declarations: Declarations always end in a semicolon
  28. CSS Anatomy 101 h1 { color: black; font-weight: bold; }

    Declarations: Declaration groups are wrapped by curly brackets
  29. CSS Anatomy 101 h1 { color: black; font-weight: bold; }

    h1 { color: black; font-weight: bold; } You can also put it all on one line
  30. CSS Anatomy 101 Add comments h1 { color: black; /*

    Hello world! */ font-weight: bold; }
  31. A few tools and resources Let me Google that for

    you http://www.w3schools.com http://www.csszengarden.com http://www.codecademy.com/tracks/web http://joshuarudd.github.com/typeset.css http://js ddle.net Your browser’s Web Inspector (or Firebug)