SlideShare ist ein Scribd-Unternehmen logo
1 von 26
WEEK 6 
WEEK 11: 
CSS (CASCADING 
STYLE SHEETS)
GOALS FOR TODAY 
• Review what CSS is 
• Writing CSS Targeting Selectors 
• Types of Selectors 
• CSS Cascade (Order) 
• Applying basic CSS properties
HTML IS THE FOUNDATION, 
CSS IS THE PRESENTATION
REVIEW: 
WHAT IS CSS? 
• CSS (Cascading Style Sheets) is a style sheet language developed to 
control the presentation (look and feel) of markup language documents, in 
our case HTML 
• CSS is a collection of formatting rules 
Examples: 
• size of font 
• color of font 
• font family 
• margins, 
• border, 
• underline etc…
WHAT IS CSS? 
<< WITHOUT CSS 
<< WITH CSS
SPECIFY AND TARGET STYLES 
There are 3 main ways to specify and target styles in our web pages
APPLYING CSS 
ANATOMY 
OF A CSS 
STYLE
ANATOMY OF A CSS STYLE
ANATOMY OF A CSS STYLE 
p { 
color: red; 
font-size: 13px; 
font-family: arial; 
font-weight: bold; 
} 
You can write CSS 
either way, they do 
the same thing 
p { color: red; font-size: 13px; font-family: arial; font-weight: bold;} 
Result: 
<p> Just some text for demonstration purposes. </p>
ELEMENT SELECTORS: 
FOR REGULAR HTML TAGS 
• The element selector selects all elements (tags) with the specified 
element name 
• These are very broad and the styles given to them would apply to all 
• Elements selectors refer to regular HTML tags 
p { color: red; } 
h1 { color: yellow; } 
ul { color: red; } 
strong { color: blue; } 
em { color: green; }
ELEMENT SELECTORS: 
FOR REGULAR HTML TAGS
CLASS SELECTORS: 
FOR ANY ELEMENT 
• Classes are html attributes that can be added to any html 
element (<p>, <h1>, <strong>, <em>, etc.) 
• Classes can be named anything 
• You can apply a class as many times on a page as needed 
• Class selectors always start with a period in the css file (.ex) 
CSS: 
.subhead { color: red; } 
HTML: 
<h2 class=”subhead”>My Subhead</h2>
CLASS SELECTORS: 
FOR ANY ELEMENT
ID SELECTORS: 
FOR ANY ONE ELEMENT ON A PAGE 
• The id selector uses the id attribute of an HTML tag to find the 
specific element. 
• An id should be unique within a page, so you should use the 
id selector when you want to find a single, unique element. 
CSS: 
#subhead { color: red; } 
HTML: 
<h2 id=”subhead”>My Subhead</h2>
CSS CASCADE (ORDER) 
From general to specific
THE CASCADE (ORDER) 
(VERY IMPORTANT!) 
• CSS cascade is very 
important, whether you 
want to style a very 
specific element on a 
page or a HTML elements 
in a general tag 
• With no CSS on a page, 
the browser’s default 
styles will be used 
• CSS is just like HTML, it is 
read top to bottom, left to 
right
WEB COLOUR 
RGB vs HEX, web safe vs millions…
WEB COLOUR 
In the Stone Age… 
In the stone age, when computers 
only supported 256 different colors, 
a list of 216 "Web Safe Colors" was 
suggested as a Web standard, 
reserving 40 fixed system colors. 
This 216 cross-browser color 
palette was created to ensure that 
all computers would display colors 
correctly:
WEB COLOURS 
Colors are displayed combining 
RED, GREEN, and BLUE light. 
The combination of Red, Green 
and Blue values from 0 to 255 
gives a total of more than 16 
million different colors to play 
with (256 x 256 x 256). 
Most modern monitors are 
capable of displaying at least 
16384 different colors.
COLOUR VALUES 
Colors are defined using a hexadecimal (hex) notation for the 
of Red, Green, and Blue values (RGB). 
• The lowest value for each light source is 0 (hex 00) 
• The highest value is 255 (hex FF) 
• Hex values are written as # followed by either three or six hex 
characters, eg: #990033 
Try it! 
• See the web links in Week 10
APPLYING STYLES TO A PAGE OR SITE
3 WAYS TO APPLY STYLES 
1 - Embedded style: 
• Typed directly into each html document, applies only to that 
document, embedded in the <head></head> section 
2 - Linked style sheet 
• Separate style sheet written and then linked to each document 
• This allows you to control the style of an entire site consisting of 
more then 1 page from 1 style sheet 
• Links to style sheets go in the <head></head> section 
3 – In-line 
• An inline style loses many of the advantages of a style sheet (by 
mixing content with presentation). Use this method sparingly! 
• To use inline styles, add the style attribute to the relevant tag
EMBEDDING CSS 
• To embedded CSS styles in your 
document the <style> tags are added 
inside of the <head></head> tags at 
the top of your document. 
• Your custom CSS styles (or rules) are 
placed inside of the <style></style> 
tags 
Embedding css directly on a 
page limits it to JUST that 
page 
• This has pros can cons: Pro: maybe 
you just need it applied to that page, 
con: doing this on multiple pages 
would be a lot of work!
LINKING CSS STYLE SHEETS 
• Linking a style sheet means that you can control the 
presentation of a site consisting of multiple pages from 1 CSS 
file 
You link to a separate file: 
• <link href="global.css" rel="stylesheet" type="text/css" /> 
• Linked Style Sheet are named with a .css extention (ie. 
global.css). 
• Linked Style Sheet are added in head section between the 
opening and closing head tags just like embedded CSS styles 
This is the technique we will be using in class
LINKED STYLE SHEETS CAN BE 
APPLIED TO MULTIPLE PAGES 
This makes updating much easier!
BASIC CSS PROPERTIES 
p {color: olive;} 
• “p” is the selector, “color” is the 
property and “olive” is the value 
color: blue; 
• modifies the color property of your 
chosen font, default is black 
• you use keywords (red) or 
hexadecimal (#e0e0e0) 
font-size: 13px; 
• modifies the size property of your 
chosen font 
• Can be measured in px, em, or pts 
font-weight: normal; 
font-weight: bold; 
• controls the weight of the font, either 
bold or normal 
background-color: yellow; 
• sets the background property of an 
element, can you use keywords (red) or 
hexadecimal (#e0e0e0) 
Important! With CSS it is 
always property first, 
value second

Weitere ähnliche Inhalte

Was ist angesagt?

1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
apnwebdev
 
Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01
Likitha47
 
Cascading style sheet (css)]
Cascading style sheet (css)]Cascading style sheet (css)]
Cascading style sheet (css)]
9574395990
 

Was ist angesagt? (20)

Introducing Cascading Style Sheets
Introducing Cascading Style SheetsIntroducing Cascading Style Sheets
Introducing Cascading Style Sheets
 
Cascading Style Sheets (CSS)
Cascading Style Sheets (CSS)Cascading Style Sheets (CSS)
Cascading Style Sheets (CSS)
 
1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
CSS 101
CSS 101CSS 101
CSS 101
 
Responsive web design with html5 and css3
Responsive web design with html5 and css3Responsive web design with html5 and css3
Responsive web design with html5 and css3
 
Introduction to css & its attributes with syntax
Introduction to css & its attributes with syntaxIntroduction to css & its attributes with syntax
Introduction to css & its attributes with syntax
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
Cascading style sheets (CSS)
Cascading style sheets (CSS)Cascading style sheets (CSS)
Cascading style sheets (CSS)
 
Html Styles-CSS
Html Styles-CSSHtml Styles-CSS
Html Styles-CSS
 
4. Web Technology CSS Basics-1
4. Web Technology CSS Basics-14. Web Technology CSS Basics-1
4. Web Technology CSS Basics-1
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Css
CssCss
Css
 
Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01
 
CSS Basic Introduction, Rules, And Tips
CSS Basic Introduction, Rules, And TipsCSS Basic Introduction, Rules, And Tips
CSS Basic Introduction, Rules, And Tips
 
Cascading style sheet (css)]
Cascading style sheet (css)]Cascading style sheet (css)]
Cascading style sheet (css)]
 
Css introduction
Css   introductionCss   introduction
Css introduction
 
Css present
Css presentCss present
Css present
 
Html
HtmlHtml
Html
 
Css
CssCss
Css
 

Andere mochten auch (9)

Week 4 - tablet app design
Week 4 - tablet app designWeek 4 - tablet app design
Week 4 - tablet app design
 
Interactive Web Design 5 - Week 2 - Introduction
Interactive Web Design 5 - Week 2 -  IntroductionInteractive Web Design 5 - Week 2 -  Introduction
Interactive Web Design 5 - Week 2 - Introduction
 
Week 3 Lecture: Accessibility
Week 3 Lecture: AccessibilityWeek 3 Lecture: Accessibility
Week 3 Lecture: Accessibility
 
Module 4 - Dreamweaver Templates (Static vs. Dynamic Content)
Module 4 - Dreamweaver Templates (Static vs. Dynamic Content)Module 4 - Dreamweaver Templates (Static vs. Dynamic Content)
Module 4 - Dreamweaver Templates (Static vs. Dynamic Content)
 
Week 12 CSS Font - size
Week 12 CSS Font - sizeWeek 12 CSS Font - size
Week 12 CSS Font - size
 
Module 3 - Intro to Bootstrap
Module 3 - Intro to BootstrapModule 3 - Intro to Bootstrap
Module 3 - Intro to Bootstrap
 
Module 5 - WCM system comparison
Module 5 - WCM system comparison Module 5 - WCM system comparison
Module 5 - WCM system comparison
 
HTML Lecture Part 1 of 2
HTML Lecture Part 1 of 2HTML Lecture Part 1 of 2
HTML Lecture Part 1 of 2
 
HTML/CSS Lecture 1
HTML/CSS Lecture 1HTML/CSS Lecture 1
HTML/CSS Lecture 1
 

Ähnlich wie Week11 Lecture: CSS

Cascading Style Sheets for web browser.pptx
Cascading Style Sheets for web browser.pptxCascading Style Sheets for web browser.pptx
Cascading Style Sheets for web browser.pptx
alvindalejoyosa1
 

Ähnlich wie Week11 Lecture: CSS (20)

Css
CssCss
Css
 
Cascading Style Sheets for web browser.pptx
Cascading Style Sheets for web browser.pptxCascading Style Sheets for web browser.pptx
Cascading Style Sheets for web browser.pptx
 
BITM3730 9-19.pptx
BITM3730 9-19.pptxBITM3730 9-19.pptx
BITM3730 9-19.pptx
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
 
BITM3730 9-20.pptx
BITM3730 9-20.pptxBITM3730 9-20.pptx
BITM3730 9-20.pptx
 
2 introduction css
2 introduction css2 introduction css
2 introduction css
 
WEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptxWEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptx
 
Css
CssCss
Css
 
CSS.pptx
CSS.pptxCSS.pptx
CSS.pptx
 
basic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdfbasic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdf
 
CSS
CSSCSS
CSS
 
uptu web technology unit 2 Css
uptu web technology unit 2 Cssuptu web technology unit 2 Css
uptu web technology unit 2 Css
 
DHTML
DHTMLDHTML
DHTML
 
Unit-3-CSS-BWT.pptx
Unit-3-CSS-BWT.pptxUnit-3-CSS-BWT.pptx
Unit-3-CSS-BWT.pptx
 
Css
CssCss
Css
 
Css basics
Css basicsCss basics
Css basics
 
Unit 3 (it workshop).pptx
Unit 3 (it workshop).pptxUnit 3 (it workshop).pptx
Unit 3 (it workshop).pptx
 
Css
CssCss
Css
 
Internet tech &amp; web prog. p4,5
Internet tech &amp; web prog.  p4,5Internet tech &amp; web prog.  p4,5
Internet tech &amp; web prog. p4,5
 

Mehr von Katherine McCurdy-Lapierre, R.G.D. (11)

Week 12 CSS Font - family
Week 12 CSS Font - familyWeek 12 CSS Font - family
Week 12 CSS Font - family
 
Week 6 Lecture
Week 6 LectureWeek 6 Lecture
Week 6 Lecture
 
Week 5 Lecture
Week 5 LectureWeek 5 Lecture
Week 5 Lecture
 
Week 4 Lecture Accessibility
Week 4 Lecture AccessibilityWeek 4 Lecture Accessibility
Week 4 Lecture Accessibility
 
Week 4 Lecture Part 1
Week 4 Lecture Part 1Week 4 Lecture Part 1
Week 4 Lecture Part 1
 
Week 4 Lecture Part 2
Week 4 Lecture Part 2Week 4 Lecture Part 2
Week 4 Lecture Part 2
 
Artistic Web Applications - Week3 - Part 1
Artistic Web Applications - Week3 - Part 1Artistic Web Applications - Week3 - Part 1
Artistic Web Applications - Week3 - Part 1
 
Artistic Web Applications - Week3 - Part 3
Artistic Web Applications - Week3 - Part 3Artistic Web Applications - Week3 - Part 3
Artistic Web Applications - Week3 - Part 3
 
Artistic Web Applications - Week3 - Part 2
Artistic Web Applications - Week3 - Part 2Artistic Web Applications - Week3 - Part 2
Artistic Web Applications - Week3 - Part 2
 
Week2 lecture-whatiswebdesign-part1
Week2 lecture-whatiswebdesign-part1Week2 lecture-whatiswebdesign-part1
Week2 lecture-whatiswebdesign-part1
 
LecWeek2 lecture-whatiswebdesign-part2
LecWeek2 lecture-whatiswebdesign-part2LecWeek2 lecture-whatiswebdesign-part2
LecWeek2 lecture-whatiswebdesign-part2
 

Kürzlich hochgeladen

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 

Kürzlich hochgeladen (20)

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 

Week11 Lecture: CSS

  • 1. WEEK 6 WEEK 11: CSS (CASCADING STYLE SHEETS)
  • 2. GOALS FOR TODAY • Review what CSS is • Writing CSS Targeting Selectors • Types of Selectors • CSS Cascade (Order) • Applying basic CSS properties
  • 3. HTML IS THE FOUNDATION, CSS IS THE PRESENTATION
  • 4. REVIEW: WHAT IS CSS? • CSS (Cascading Style Sheets) is a style sheet language developed to control the presentation (look and feel) of markup language documents, in our case HTML • CSS is a collection of formatting rules Examples: • size of font • color of font • font family • margins, • border, • underline etc…
  • 5. WHAT IS CSS? << WITHOUT CSS << WITH CSS
  • 6. SPECIFY AND TARGET STYLES There are 3 main ways to specify and target styles in our web pages
  • 7. APPLYING CSS ANATOMY OF A CSS STYLE
  • 8. ANATOMY OF A CSS STYLE
  • 9. ANATOMY OF A CSS STYLE p { color: red; font-size: 13px; font-family: arial; font-weight: bold; } You can write CSS either way, they do the same thing p { color: red; font-size: 13px; font-family: arial; font-weight: bold;} Result: <p> Just some text for demonstration purposes. </p>
  • 10. ELEMENT SELECTORS: FOR REGULAR HTML TAGS • The element selector selects all elements (tags) with the specified element name • These are very broad and the styles given to them would apply to all • Elements selectors refer to regular HTML tags p { color: red; } h1 { color: yellow; } ul { color: red; } strong { color: blue; } em { color: green; }
  • 11. ELEMENT SELECTORS: FOR REGULAR HTML TAGS
  • 12. CLASS SELECTORS: FOR ANY ELEMENT • Classes are html attributes that can be added to any html element (<p>, <h1>, <strong>, <em>, etc.) • Classes can be named anything • You can apply a class as many times on a page as needed • Class selectors always start with a period in the css file (.ex) CSS: .subhead { color: red; } HTML: <h2 class=”subhead”>My Subhead</h2>
  • 13. CLASS SELECTORS: FOR ANY ELEMENT
  • 14. ID SELECTORS: FOR ANY ONE ELEMENT ON A PAGE • The id selector uses the id attribute of an HTML tag to find the specific element. • An id should be unique within a page, so you should use the id selector when you want to find a single, unique element. CSS: #subhead { color: red; } HTML: <h2 id=”subhead”>My Subhead</h2>
  • 15. CSS CASCADE (ORDER) From general to specific
  • 16. THE CASCADE (ORDER) (VERY IMPORTANT!) • CSS cascade is very important, whether you want to style a very specific element on a page or a HTML elements in a general tag • With no CSS on a page, the browser’s default styles will be used • CSS is just like HTML, it is read top to bottom, left to right
  • 17. WEB COLOUR RGB vs HEX, web safe vs millions…
  • 18. WEB COLOUR In the Stone Age… In the stone age, when computers only supported 256 different colors, a list of 216 "Web Safe Colors" was suggested as a Web standard, reserving 40 fixed system colors. This 216 cross-browser color palette was created to ensure that all computers would display colors correctly:
  • 19. WEB COLOURS Colors are displayed combining RED, GREEN, and BLUE light. The combination of Red, Green and Blue values from 0 to 255 gives a total of more than 16 million different colors to play with (256 x 256 x 256). Most modern monitors are capable of displaying at least 16384 different colors.
  • 20. COLOUR VALUES Colors are defined using a hexadecimal (hex) notation for the of Red, Green, and Blue values (RGB). • The lowest value for each light source is 0 (hex 00) • The highest value is 255 (hex FF) • Hex values are written as # followed by either three or six hex characters, eg: #990033 Try it! • See the web links in Week 10
  • 21. APPLYING STYLES TO A PAGE OR SITE
  • 22. 3 WAYS TO APPLY STYLES 1 - Embedded style: • Typed directly into each html document, applies only to that document, embedded in the <head></head> section 2 - Linked style sheet • Separate style sheet written and then linked to each document • This allows you to control the style of an entire site consisting of more then 1 page from 1 style sheet • Links to style sheets go in the <head></head> section 3 – In-line • An inline style loses many of the advantages of a style sheet (by mixing content with presentation). Use this method sparingly! • To use inline styles, add the style attribute to the relevant tag
  • 23. EMBEDDING CSS • To embedded CSS styles in your document the <style> tags are added inside of the <head></head> tags at the top of your document. • Your custom CSS styles (or rules) are placed inside of the <style></style> tags Embedding css directly on a page limits it to JUST that page • This has pros can cons: Pro: maybe you just need it applied to that page, con: doing this on multiple pages would be a lot of work!
  • 24. LINKING CSS STYLE SHEETS • Linking a style sheet means that you can control the presentation of a site consisting of multiple pages from 1 CSS file You link to a separate file: • <link href="global.css" rel="stylesheet" type="text/css" /> • Linked Style Sheet are named with a .css extention (ie. global.css). • Linked Style Sheet are added in head section between the opening and closing head tags just like embedded CSS styles This is the technique we will be using in class
  • 25. LINKED STYLE SHEETS CAN BE APPLIED TO MULTIPLE PAGES This makes updating much easier!
  • 26. BASIC CSS PROPERTIES p {color: olive;} • “p” is the selector, “color” is the property and “olive” is the value color: blue; • modifies the color property of your chosen font, default is black • you use keywords (red) or hexadecimal (#e0e0e0) font-size: 13px; • modifies the size property of your chosen font • Can be measured in px, em, or pts font-weight: normal; font-weight: bold; • controls the weight of the font, either bold or normal background-color: yellow; • sets the background property of an element, can you use keywords (red) or hexadecimal (#e0e0e0) Important! With CSS it is always property first, value second