Cascading Style Sheets Chris Vollmer IT 5610 Chatfield Senior High School.

12
Cascading Style Cascading Style Sheets Sheets Chris Vollmer Chris Vollmer IT 5610 IT 5610 Chatfield Senior High Chatfield Senior High School School

description

What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles are normally stored in Style Sheets External Style Sheets are stored in CSS files Multiple style definitions will cascade into one

Transcript of Cascading Style Sheets Chris Vollmer IT 5610 Chatfield Senior High School.

Page 1: Cascading Style Sheets Chris Vollmer IT 5610 Chatfield Senior High School.

Cascading Style Cascading Style SheetsSheets

Chris VollmerChris VollmerIT 5610IT 5610

Chatfield Senior High SchoolChatfield Senior High School

Page 2: Cascading Style Sheets Chris Vollmer IT 5610 Chatfield Senior High School.

Table of Contents• What is CSS• Using Cascading

Style Sheets• Why Cascading

Style Sheets• Types of CSS

•External•Internal•Inline•Class•Try Some•Helpful Links

Page 3: Cascading Style Sheets Chris Vollmer IT 5610 Chatfield Senior High School.

What is CSS?• CSS stands for Cascading Style Sheets • Styles define how to display HTML

elements • Styles are normally stored in Style

Sheets • External Style Sheets are stored in CSS

files • Multiple style definitions will cascade

into one http://www.w3schools.com/css/css_intro.asp

Page 4: Cascading Style Sheets Chris Vollmer IT 5610 Chatfield Senior High School.

Using Cascading Style Sheets• Cascading Style Sheets are mainly used

to separate the presentation aspects of a web page from the content aspects.

• CSS are used for presentation, HTML is used for structure.

• Things to keep in mind…–Human disabilities (508 compliant)–Version of browser–Text based browsers–Handheld internet devices

Page 5: Cascading Style Sheets Chris Vollmer IT 5610 Chatfield Senior High School.

Why Cascading Style Sheets?Multiple style definitions will

cascade into oneo Browser default o External Style Sheet o Internal Style Sheet (inside the <head> tag) o Inline Style (inside HTML element)

• Allow you to accomplish morefixed background images

Page 6: Cascading Style Sheets Chris Vollmer IT 5610 Chatfield Senior High School.

Types of CSS• ExternalExternal – ideal when same style

is applied to several pages• InternalInternal – style is applied to a

single document• InlineInline – Single occurrence within a

page (ie. Single word, cell of table)• ClassClass – custom style

Page 7: Cascading Style Sheets Chris Vollmer IT 5610 Chatfield Senior High School.

External Style Sheet• Separate from .html file• Tag placed in .html to link .html to

.css (external style sheet file)

<head><link rel=“stylesheet” type=“text/css” href=“filename.css”></head>example

Page 8: Cascading Style Sheets Chris Vollmer IT 5610 Chatfield Senior High School.

Internal Style Sheet• Created within the .html file between

<head><style type=“text/css”>Styles defined

</head>• Format includes 3 parts:

selector {property: value}body {color: black or #ffffff}

Page 9: Cascading Style Sheets Chris Vollmer IT 5610 Chatfield Senior High School.

Inline Style Sheets•Use this sparingly, mixes

content with presentation•Tag placed around text or

image that you are applying the attribute<p style="color: sienna; margin-left: 20px"> Text goes here</p>

Page 10: Cascading Style Sheets Chris Vollmer IT 5610 Chatfield Senior High School.

Class (Custom)• Define different styles for same html tag

#1 <p class=“right”> align right#2 <p class=“center”> align center<head> p.right{text-align: right} p.center{text-align:center}</head>

• You can omit the html tag and create your own class

.alpha a:link, .alpha a:visited{font- size: 12px;}

Page 11: Cascading Style Sheets Chris Vollmer IT 5610 Chatfield Senior High School.

Helpful LinksW3Schools, CSS2 Reference Page,

http://www.w3schools.com/css/css_reference.asp- Comprehensive list of css2 tagsCSS Zen Garden, homepage,

http://www.csszengarden.com/- Great examples of how CSS is used for presentationSection 508, homepage,

http://www.section508.gov/index.cfm?FuseAction=Content&ID=3

- Government site describing Rehabilitation Act section 508 that deals with access to information on the internet

Page 12: Cascading Style Sheets Chris Vollmer IT 5610 Chatfield Senior High School.

Try Some1. Background color and heading

tags, http://www.w3schools.com/css/tryit.asp?filename=trycss_background-color

2. Text color, alignment, backgroundhttp://www.w3schools.com/css/css_text.asp

3. You choosehttp://www.w3schools.com/css/css_background.asp