BloggingWithStyle_2008
- 1. Style
Blogging with
An Introduction to CSS
Presented by Anthony Piraino at ConvergeSouth 2008
- 6. HTML
HyperText Markup Language
Describes the semantics and structure
of content on a web page.
- 7. CSS
Cascading Style Sheets
Describes the presentation of content
on a web page by defining design elements
such as layout, fonts, and colors.
- 19. How do they work together?
CSS lets you define visual styling by
targeting rules to individual HTML elements.
- 20. <html>
<body>
<h1>This is a header</h1>
<p>
Here is a block of
paragraph text, blah
blah blah etc.
HTML </p>
<h2>Another header</h2>
<p>
And yet another paragraph
with a block of text.
</p>
</body>
</html>
- 21. 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;
CSS
}
h2 {
font-size: 1.4em;
background-color: #ffffff;
padding: 0px 30px 0px 30px;
}
p {
background-color: #ffffff;
padding: 30px;
margin: 0px;
}
- 24. body {
font-family: "trebuchet ms", sans-serif;
<body> background-color: #ddeedd;
padding: 20px 100px 0px 100px;
<h1>This is a header</h1> }
<p> h1, h2 {
Here is a block of font-size: 1.8em;
paragraph text, blah color: #88aa44;
blah blah etc. margin: 0px;
</p> }
h2 {
<h2>Another header</h2> font-size: 1.4em;
background-color: #ffffff;
<p> padding: 0px 30px 0px 30px;
And yet another paragraph }
with a block of text.
</p> p {
background-color: #ffffff;
</body> padding: 30px;
margin: 0px;
}
HTML CSS
- 25. CSS Syntax
A stylesheet lists rules for presentation.
Each rule consists of a selector and a
declaration block.
- 27. The Type Selector
p {
color: #1662d8;
background-color: #ffffff;
padding: 10px;
border: 5px solid #1bc8fe;
}
- 28. 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;
}
- 29. 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>
- 30. p {
color: gray;
font-size: 12px;
}
p.alert {
color: red;
font-size: 18px;
font-weight: bold;
}
- 31. This is a normal paragraph, nothing
exciting going on here.
But this is a really important
paragraph - pay attention!
- 32. The ID Selector
HTML <ul id=”contents”>
<li>Chapter 1</li>
<li>Chapter 2</li>
<li>Chapter 3</li>
</ul>
CSS #contents {
font-weight: bold;
font-size: 18px;
}
- 33. 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>
- 34. blockquote p {
color: blue;
font-weight: bold;
border-left: 3px solid blue;
padding-left: 10px;
}
- 35. This is a stand-alone paragraph.
A paragraph inside our
blockquote.
And another blockquoted
paragraph.
- 40. By Name
aqua, black, blue, fuchsia, gray, etc.
Full list of supported color names:
http://www.w3schools.com/css/css_colornames.asp
- 42. Red Green Blue
#00 00 00
- 52. #outer-wrapper {
width: 660px;
margin:0 auto;
padding:10px;
text-align:$startSide;
font: $bodyfont;
}
- 54. #outer-wrapper {
width: 660px;
margin:0 auto;
padding: 10px;
text-align:$startSide;
font: $bodyfont;
}
- 55. #outer-wrapper {
width: 660px;
margin:0 auto;
padding: 10px 40px 10px 40px;
text-align:$startSide;
font: $bodyfont;
}
- 56. #outer-wrapper {
width: 660px;
margin:0 auto;
padding: 10px 40px 10px 40px;
text-align:$startSide;
font: $bodyfont;
background-color: #effcff;
border-left: 10px solid #003;
border-right: 10px solid #003;
}
- 59. #header-wrapper {
width:660px;
margin:0 auto 10px;
border:1px solid $bordercolor;
}
#header {
margin: 5px;
border: 1px solid $bordercolor;
text-align: center;
color:$pagetitlecolor;
}
#header h1 {
margin:5px 5px 0;
padding:15px 20px .25em;
line-height:1.2em;
text-transform:uppercase;
letter-spacing:.2em;
font: $pagetitlefont;
}
- 64. #header-wrapper {
width:660px;
margin:0 auto 10px;
border:1px solid $bordercolor;
}
#header {
margin: 5px;
border: 1px solid $bordercolor;
text-align: center;
color:$pagetitlecolor;
}
#header h1 {
margin:5px 5px 0;
padding:15px 20px .25em;
line-height:1.2em;
text-transform:uppercase;
letter-spacing:.2em;
font: $pagetitlefont;
}
- 65. #header-wrapper {
width:660px;
margin:0 auto 10px;
border:1px solid $bordercolor;
}
#header {
margin: 5px;
border: 1px solid $bordercolor;
text-align: center;
color:$pagetitlecolor;
}
#header h1 {
margin:5px 5px 0;
padding:15px 20px .25em;
line-height:1.2em;
text-transform:uppercase;
letter-spacing:.2em;
font: $pagetitlefont;
}
- 66. #header-wrapper {
width:660px;
margin: 0px 0px 20px 0px;
border:1px solid $bordercolor;
}
#header {
margin: 5px;
border: 1px solid $bordercolor;
text-align: center;
color:$pagetitlecolor;
}
#header h1 {
margin:5px 5px 0;
padding:15px 20px .25em;
line-height:1.2em;
text-transform:uppercase;
letter-spacing:.2em;
font: $pagetitlefont;
}
- 67. #header-wrapper {
width:660px;
margin: 0px 0px 20px 0px;
border-bottom: 1px solid #c1cccf;
}
#header {
margin: 5px;
border: 1px solid $bordercolor;
text-align: center;
color:$pagetitlecolor;
}
#header h1 {
margin:5px 5px 0;
padding:15px 20px .25em;
line-height:1.2em;
text-transform:uppercase;
letter-spacing:.2em;
font: $pagetitlefont;
}
- 68. #header-wrapper {
width:660px;
margin: 0px 0px 20px 0px;
border-bottom: 1px solid #c1cccf;
}
#header {
color:$pagetitlecolor;
}
#header h1 {
margin:5px 5px 0;
padding:15px 20px .25em;
line-height:1.2em;
text-transform:uppercase;
letter-spacing:.2em;
font: $pagetitlefont;
}
- 69. #header-wrapper {
width:660px;
margin: 0px 0px 20px 0px;
border-bottom: 1px solid #c1cccf;
}
#header {
color: #000033;
}
#header h1 {
margin:5px 5px 0;
padding:15px 20px .25em;
line-height:1.2em;
text-transform:uppercase;
letter-spacing:.2em;
font: $pagetitlefont;
}
- 70. #header-wrapper {
width:660px;
margin: 0px 0px 20px 0px;
border-bottom: 1px solid #c1cccf;
}
#header {
color: #000033;
}
#header h1 {
margin: 0px;
padding:15px 20px .25em;
line-height:1.2em;
text-transform:uppercase;
letter-spacing:.2em;
font: $pagetitlefont;
}
- 71. #header-wrapper {
width:660px;
margin: 0px 0px 20px 0px;
border-bottom: 1px solid #c1cccf;
}
#header {
color: #000033;
}
#header h1 {
margin: 0px;
padding: 30px 0px 0px 0px;
line-height:1.2em;
text-transform:uppercase;
letter-spacing:.2em;
font: $pagetitlefont;
}
- 74. .sidebar .widget, .main .widget {
border-bottom:1px dotted $bordercolor;
margin:0 0 1.5em;
padding:0 0 1.5em;
}
- 77. .sidebar .widget, .main .widget {
margin:0px;
padding:0 0 1.5em;
}
#sidebar-wrapper h2 {
background-color: #113355;
padding: 3px 0px 3px 5px;
color: #ffffff;
}
- 81. Resources and Next Steps
Selectutorial
http://css.maxdesign.com.au/selectutorial/
W3Schools CSS Tutorial
http://www.w3schools.com/css/
CSS Zen Garden
http://www.csszengarden.com/