• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
You and Your Stylesheet
 

You and Your Stylesheet

on

  • 3,234 views

A brief program on basics of blog CSS for beginners presented at the BlogHer09 Geek Lab.

A brief program on basics of blog CSS for beginners presented at the BlogHer09 Geek Lab.

Statistics

Views

Total Views
3,234
Views on SlideShare
3,126
Embed Views
108

Actions

Likes
0
Downloads
5
Comments
0

2 Embeds 108

http://www.blogher.com 93
http://m.blogher.com 15

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • This is a rule targeting the content div on a blog page.
  • This is a rule targeting the content div on a blog page.
  • This is a rule targeting the content div on a blog page.
  • This is a rule targeting the content div on a blog page.
  • There are several ways to figure out what selector you need to look for in the stylesheet. One uses the Web Developer Toolbar in Firefox. Other browsers have similar tools to help web developers. Or you can just search through View Source and figure it out.
  • With Web Developer Toolbar
  • Using View Source you can figure out approximately the same information to see which selector may be the one you want to target.

You and Your Stylesheet You and Your Stylesheet Presentation Transcript

  • You and Your Stylesheet
    Virginia DeBolt
    BlogHer 09
  • 30 Minute Goals
    Talk about what CSS can do
    Talk about what a style rule looks like
    Talk about how to identify the style that matches the part of your page you want to style
    Answer your specific questions
  • What CSS can Do
    Set color and background color for any element
    Set font and font size for any element
    Set margins, borders and padding around any element
    Create layouts
    Create list appearance
    Create link appearance
    And more!
  • A CSS rule tells the browser how to render the HTML
    div#content {
    font-family: Frutiger, Univers, "Helvetica Neue", arial, helvetica, sans-serif;
    font-size: 1em;
    line-height: 1.4;
    background:#fff;
    color:#000;
    margin:0 1em;
    padding:0 1em 0 0;
    }
  • The Selector selects the element to style
    div#content {
    font-family: Frutiger, Univers, "Helvetica Neue", arial, helvetica, sans-serif;
    font-size: 1em;
    line-height: 1.4;
    background:#fff;
    color:#000;
    margin:0 1em;
    padding:0 1em 0 0;
    }
  • The declaration is inside {}
    div#content {
    font-family: Frutiger, Univers, "Helvetica Neue", arial, helvetica, sans-serif;
    font-size: 1em;
    line-height: 1.4;
    background:#fff;
    color:#000;
    margin:0 1em;
    padding:0 1em 0 0;
    }
  • The property is a property of the element you are styling
    div#content{
    font-family: Frutiger, Univers, "Helvetica Neue", arial, helvetica, sans-serif;
    font-size: 1em;
    line-height: 1.4;
    background:#fff;
    color:#000;
    margin:0 1em;
    padding:0 1em 0 0;
    }
  • The value sets how you want each property of the selector to look
    div#content{
    font-family: Frutiger, Univers, "Helvetica Neue", arial, helvetica, sans-serif;
    font-size: 1em;
    line-height: 1.4;
    background:#fff;
    color:#000;
    margin:0 1em;
    padding:0 1em 0 0;
    }
  • How can you figure out which selector to change?
    Out of all the notes on the piano which one do you press?
    Out of all the selectors and rules in the stylesheet, which one do you change?
  • Figuring out the Selectors with Web Developer Toolbar in Firefox
  • Figuring out the selectors with View Source
    <div id="container">
    <div id="content" class="hfeed”>
    <div id="post-2819" class="hentryp1 post publish author-vdebolt category-blogher category-news-politics category-socialmedia category-twitter y2009 m06 d30 h04">
    <h2 class="entry-title"><a href="http://www.webteacher.ws/2009/06/30/spreading-the-news/" title="Permalink to Spreading the News" rel="bookmark">Spreading the News</a></h2>
    <div class="entry-date"><abbr class="published" title="2009-06-30T07:18:37-0400">Tuesday, June 30, 2009</abbr></div>
    <div class="entry-content">
    <p>Remember how remarkable it seemed several months ago when a plane sat down in the Hudson River and the first news and photos of the crash came from Twitter? Then the fly ash spill in TVA’s Kingston plant was covered first on Twitter. That was about the time that articles about how the old media just didn’t get digital media started appearing.</p>
  • Sometimes several selectors have the same rule
    body.single h2.entry-title, body.page h2.entry-title, body.search h2.entry-title {
    margin:1em 0 -0.5em;
    }
    A comma separated list of selectors—all follow the same rule.
  • Sometimes selectors get really specific
    div.entry-content cite, div.comments ol.commentlist cite {
    border-bottom:1px dotted #999;
    cursor:help;
    }
    Selects any cite element that is a descendant of an ol element with a class attribute that contains the word commentlist that is a descendant of a div element with a class attribute that contains the word comments.
  • When you are trying to change something, you may need to get really specific too.
    ol {} not specific enough?
    Try div.entry-content ol {} instead.
    .small {} not specific enough?
    Try div#content p.small
  • Let’s talk about your problems
    Questions?
  • Resources
    CSS cascade - a simple step-by-step presentation: http://www.maxdesign.com.au/2009/06/30/css-cascade/
    Web Teacher Tips: http://www.webteacher.ws/web-teacher-tips-and-tutorials/
    CSS: The Definitive Guide by Eric A. Meyer, O’Reilly, 2007