bloggingwithstyle_2008

82
Sty le Blogging with An Introduction to CSS Presented by Anthony Piraino at ConvergeSouth 2008

Upload: tutorialsruby

Post on 06-Sep-2014

1.651 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: BloggingWithStyle_2008

StyleBlogging with

An Introduction to CSS

Presented by Anthony Piraino at ConvergeSouth 2008

Page 2: BloggingWithStyle_2008

What is CSS and why should I learn it?

Page 3: BloggingWithStyle_2008
Page 4: BloggingWithStyle_2008

Your Blog: Under the Hood

Page 5: BloggingWithStyle_2008

HTML vs. CSS

Page 6: BloggingWithStyle_2008

HTMLHyperText Markup Language

Describes the semantics and structure

of content on a web page.

Page 7: BloggingWithStyle_2008

CSSCascading Style Sheets

Describes the presentation of content

on a web page by defining design elements

such as layout, fonts, and colors.

Page 8: BloggingWithStyle_2008
Page 9: BloggingWithStyle_2008
Page 10: BloggingWithStyle_2008
Page 11: BloggingWithStyle_2008
Page 12: BloggingWithStyle_2008
Page 13: BloggingWithStyle_2008
Page 14: BloggingWithStyle_2008
Page 15: BloggingWithStyle_2008
Page 16: BloggingWithStyle_2008
Page 17: BloggingWithStyle_2008
Page 18: BloggingWithStyle_2008
Page 19: BloggingWithStyle_2008

How do they work together?

CSS lets you define visual styling by targeting rules to individual HTML elements.

Page 20: BloggingWithStyle_2008

HTML

<html>

<body>

<h1>This is a header</h1>

<p> Here is a block of paragraph text, blah blah blah etc. </p>

<h2>Another header</h2>

<p> And yet another paragraph with a block of text. </p>

</body>

</html>

Page 21: BloggingWithStyle_2008

CSS

body { font-family: "trebuchet ms", sans-serif; background-color: #ddeedd; padding: 20px 100px 0px 100px; }

h1, h2 { font-size: 1.8em; color: #88aa44; margin: 0px; }

h2 { font-size: 1.4em; background-color: #ffffff; padding: 0px 30px 0px 30px; }

p { background-color: #ffffff; padding: 30px; margin: 0px; }

Page 22: BloggingWithStyle_2008
Page 23: BloggingWithStyle_2008
Page 24: BloggingWithStyle_2008

<body>

<h1>This is a header</h1>

<p> Here is a block of paragraph text, blah blah blah etc. </p>

<h2>Another header</h2>

<p> And yet another paragraph with a block of text. </p>

</body>

body { font-family: "trebuchet ms", sans-serif; background-color: #ddeedd; padding: 20px 100px 0px 100px; }

h1, h2 { font-size: 1.8em; color: #88aa44; margin: 0px; }

h2 { font-size: 1.4em; background-color: #ffffff; padding: 0px 30px 0px 30px; }

p { background-color: #ffffff; padding: 30px; margin: 0px; }

HTML CSS

Page 25: BloggingWithStyle_2008

CSS Syntax

A stylesheet lists rules for presentation.

Each rule consists of a selector and a declaration block.

Page 26: BloggingWithStyle_2008

selector { property: value; }

Page 27: BloggingWithStyle_2008

The Type Selector

p { color: #1662d8; background-color: #ffffff; padding: 10px; border: 5px solid #1bc8fe; }

Page 28: BloggingWithStyle_2008

Here is an example paragraph with a

styled font, color, padding and border.

p { color: #1662d8; background-color: #ffffff; padding: 10px; border: 5px solid #1bc8fe; }

Page 29: BloggingWithStyle_2008

The Class Selector

<p> This is a normal paragraph, nothing exciting going on here.</p>

<p class=”alert”> But this is a really important paragraph - pay attention!</p>

Page 30: BloggingWithStyle_2008

p { color: gray; font-size: 12px; }

p.alert { color: red; font-size: 18px; font-weight: bold; }

Page 31: BloggingWithStyle_2008

This is a normal paragraph, nothingexciting going on here.

But this is a really importantparagraph - pay attention!

Page 32: BloggingWithStyle_2008

The ID Selector

<ul id=”contents”> <li>Chapter 1</li> <li>Chapter 2</li> <li>Chapter 3</li></ul>

#contents { font-weight: bold; font-size: 18px; }

HTML

CSS

Page 33: BloggingWithStyle_2008

Descendant Selectors<p> This is a stand-alone paragraph.</p>

<blockquote>

<p> A paragraph inside our blockquote. </p>

<p> And another blockquoted paragraph. </p>

</blockquote>

Page 34: BloggingWithStyle_2008

blockquote p { color: blue; font-weight: bold; border-left: 3px solid blue; padding-left: 10px; }

Page 35: BloggingWithStyle_2008

This is a stand-alone paragraph.

A paragraph inside our blockquote.

And another blockquoted paragraph.

Page 36: BloggingWithStyle_2008

{ The Declaration Block }

Page 37: BloggingWithStyle_2008

Properties and Values

Jan Feb March April May June

Value of my House

Page 38: BloggingWithStyle_2008

Properties and Values

selector { property: value; property: value; }

Page 39: BloggingWithStyle_2008

color

Page 40: BloggingWithStyle_2008

By Name

aqua, black, blue, fuchsia, gray, etc.

Full list of supported color names:http://www.w3schools.com/css/css_colornames.asp

Page 41: BloggingWithStyle_2008

By Hex Value

Roses are #ff0000

Violets are #0000ff

Page 42: BloggingWithStyle_2008

Red Green Blue

#00 00 00

Page 43: BloggingWithStyle_2008

http://www.colorpicker.com/

Page 44: BloggingWithStyle_2008

background-color

Page 45: BloggingWithStyle_2008

margin

padding

border

Page 46: BloggingWithStyle_2008

The Box Model

element

padding

border

margin

Page 47: BloggingWithStyle_2008

Margin and Padding Values

margin: 0px 20px 10px 20px;

top right bottom left

Page 48: BloggingWithStyle_2008

Pimp my CSS

Page 49: BloggingWithStyle_2008
Page 50: BloggingWithStyle_2008
Page 51: BloggingWithStyle_2008
Page 52: BloggingWithStyle_2008

{ width: 660px; margin:0 auto; padding:10px; text-align:$startSide; font: $bodyfont; }

#outer-wrapper

Page 53: BloggingWithStyle_2008

#outer-wrapper

Page 54: BloggingWithStyle_2008

background-color: #effcff;border-left: 10px solid #003;border-right: 10px solid #003;

#outer-wrapper { width: 660px; margin:0 auto; padding: text-align:$startSide; font: $bodyfont;

10px;

}

10px 40px 10px 40px;

Page 55: BloggingWithStyle_2008

background-color: #effcff;border-left: 10px solid #003;border-right: 10px solid #003;

#outer-wrapper { width: 660px; margin:0 auto; padding: text-align:$startSide; font: $bodyfont;}

10px 40px 10px 40px;

Page 56: BloggingWithStyle_2008

background-color: #effcff;border-left: 10px solid #003;border-right: 10px solid #003;

#outer-wrapper { width: 660px; margin:0 auto; padding: text-align:$startSide; font: $bodyfont;

}

10px 40px 10px 40px;

Page 57: BloggingWithStyle_2008
Page 58: BloggingWithStyle_2008
Page 59: BloggingWithStyle_2008

{ width:660px; margin:0 auto 10px; border:1px solid $bordercolor; }

{ margin: 5px; border: 1px solid $bordercolor; text-align: center; color:$pagetitlecolor; }

{ margin:5px 5px 0; padding:15px 20px .25em; line-height:1.2em; text-transform:uppercase; letter-spacing:.2em; font: $pagetitlefont; }

#header-wrapper

#header

#header h1

Page 60: BloggingWithStyle_2008

#header-wrapper

#header

#header h1

Page 61: BloggingWithStyle_2008

#header-wrapper

#header

#header h1

Page 62: BloggingWithStyle_2008

#header-wrapper

#header

#header h1

Page 63: BloggingWithStyle_2008

#header-wrapper

#header

#header h1

Page 64: BloggingWithStyle_2008

{ width:660px; margin:0 auto 10px; border:1px solid $bordercolor; }

{ margin: 5px; border: 1px solid $bordercolor; text-align: center; color:$pagetitlecolor; }

{ margin:5px 5px 0; padding:15px 20px .25em; line-height:1.2em; text-transform:uppercase; letter-spacing:.2em; font: $pagetitlefont; }

#header-wrapper

#header

#header h1

Page 65: BloggingWithStyle_2008

#header {

#header h1 { margin: padding: line-height:1.2em; text-transform:uppercase; letter-spacing:.2em; font: $pagetitlefont; }

#header-wrapper { width:660px; margin:

0 auto 10px;border:1px solid $bordercolor;}

}

margin: 5px; border: 1px solid $bordercolor; text-align: center;color:$pagetitlecolor;

5px 5px 0;15px 20px .25em;

Page 66: BloggingWithStyle_2008

#header {

#header h1 { margin: padding: line-height:1.2em; text-transform:uppercase; letter-spacing:.2em; font: $pagetitlefont; }

#header-wrapper { width:660px; margin: border:1px solid $bordercolor;}

}

margin: 5px; border: 1px solid $bordercolor; text-align: center;color:$pagetitlecolor;

5px 5px 0;15px 20px .25em;

0px 0px 20px 0px;

Page 67: BloggingWithStyle_2008

#header {

#header h1 { margin: padding: line-height:1.2em; text-transform:uppercase; letter-spacing:.2em; font: $pagetitlefont; }

#header-wrapper { width:660px; margin: }

}

margin: 5px; border: 1px solid $bordercolor; text-align: center;color:$pagetitlecolor;

5px 5px 0;15px 20px .25em;

0px 0px 20px 0px;border-bottom: 1px solid #c1cccf;

Page 68: BloggingWithStyle_2008

#header {

#header h1 { margin: padding: line-height:1.2em; text-transform:uppercase; letter-spacing:.2em; font: $pagetitlefont; }

#header-wrapper { width:660px; margin: }

}color:$pagetitlecolor;

5px 5px 0;15px 20px .25em;

0px 0px 20px 0px;border-bottom: 1px solid #c1cccf;

Page 69: BloggingWithStyle_2008

#header {

#header h1 { margin: padding: line-height:1.2em; text-transform:uppercase; letter-spacing:.2em; font: $pagetitlefont; }

#header-wrapper { width:660px; margin: }

}color:

5px 5px 0;15px 20px .25em;

0px 0px 20px 0px;border-bottom: 1px solid #c1cccf;

#000033;

Page 70: BloggingWithStyle_2008

#header {

#header h1 { margin: padding: line-height:1.2em; text-transform:uppercase; letter-spacing:.2em; font: $pagetitlefont; }

#header-wrapper { width:660px; margin: }

}color:

15px 20px .25em;

0px 0px 20px 0px;border-bottom: 1px solid #c1cccf;

0px;

#000033;

Page 71: BloggingWithStyle_2008

#header {

#header h1 { margin: padding: line-height:1.2em; text-transform:uppercase; letter-spacing:.2em; font: $pagetitlefont; }

#header-wrapper { width:660px; margin: }

}color:

0px 0px 20px 0px;border-bottom: 1px solid #c1cccf;

0px;30px 0px 0px 0px;

#000033;

Page 72: BloggingWithStyle_2008
Page 73: BloggingWithStyle_2008
Page 74: BloggingWithStyle_2008

.sidebar .widget, .main .widget {

border-bottom:1px dotted $bordercolor;margin:0 0 1.5em;

padding:0 0 1.5em; }

Page 75: BloggingWithStyle_2008

.sidebar .widget, .main .widget {

margin:0 0 1.5em; padding:0 0 1.5em; }

Page 76: BloggingWithStyle_2008

.sidebar .widget, .main .widget {

margin: padding:0 0 1.5em; }

0px;

Page 77: BloggingWithStyle_2008

.sidebar .widget, .main .widget {

#sidebar-wrapper h2 { background-color: #113355; padding: 3px 0px 3px 5px; color: #ffffff; }

margin: padding:0 0 1.5em; }

0px;

Page 78: BloggingWithStyle_2008
Page 79: BloggingWithStyle_2008
Page 80: BloggingWithStyle_2008
Page 81: BloggingWithStyle_2008

Resources and Next Steps

Selectutorialhttp://css.maxdesign.com.au/selectutorial/

W3Schools CSS Tutorialhttp://www.w3schools.com/css/

CSS Zen Gardenhttp://www.csszengarden.com/

Page 82: BloggingWithStyle_2008

</slideshow >