SlideShare a Scribd company logo
Tutorial 3
Introducing Cascading Style Sheets

Blended HTML and CSS
Fundamentals
3rd EDITION
Objectives 3.1
•
•
•
•
•

XP

Understand the advantages of using CSS
Define a style rule
Apply color using CSS
Create internal and external style sheets
Change the appearance of a link using CSS

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

2
Objectives 3.2

XP

• Explore the five generic fonts
• Understand the importance of using Web-safe
fonts
• Change the size and decoration properties of text
• Manipulate the letter spacing, word spacing, and
line height of text
• Set the first line indentation and change text to
uppercase using CSS
• Set alignment to center text horizontally
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

3
Introducing CSS

XP

• Cascading Style Sheets (CSS) is used to format
Web pages.
• CSS offers many advantages, including:
– greater consistency in your Web page
– easily modified code
– more flexible formatting

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

4
History of CSS

XP

• CSS1 (1996) enabled users to set font size; align text
center, left, or right; set body margins; and apply
background and foreground colors to page elements.
• CSS2 (1998) included features such as design styles
for different output devices such as print media and
aural devices, and controlling the appearance and
behavior of browser features.
• CSS3 (2005) includes text effects such as drop
shadows and Web fonts, semitransparent colors, box
outlines, and rotating page elements.
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

5
Defining a Style Rule

XP

• Using CSS, you can change how an HTML
element appears in browsers.
• A style rule is the combination of a selector, a
property, and a value.
• The property is the name of a specific feature.
• The property value provides a setting for the
associated feature.
• The selector identifies the element to which
you are applying a style.
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

6
The Structure of a Style Rule
selector {
property1: value1;
property2: value2;
property3: value3;
…
}

XP

h1 {
color: yellow;
text-align: center;
}

• A style sheet is a collection of one or more
style rules, either within an HTML document
or in a separate CSS document.
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

7
Defining Color

XP

• 16 basic color names are standard in CSS2; a
more extensive list of color names was
incorporated in CSS3.

color: color-value;

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

8
Implementing Inline Styles

XP

• An inline style rule is a style rule that is
embedded inside an HTML start tag.

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

9
Embedded Style Sheets

XP

• The inline style method is discouraged because the
power of CSS is its ability to separate the
presentation (styles) from the content.
• An embedded style sheet is a set of style rules
contained between the <style> start tag and the
</style> end tag in the head section of an HTML
document:
<style type = "text/css">
style rules

</style>
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

10
Embedded Style Sheets

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

XP

11
External Style Sheets

XP

• If styles are to be used across several pages in
a Web site, it’s much more efficient to create a
separate document that contains the styles,
known as an external style sheet.
• Then you should use the link element to link
the external style sheet to the Web pages.
• Comments should be used in style sheets to
describe information about the style and to
identify its sections.
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

12
Background Color

XP

• Background color can be defined for most
elements.
• The background color for heading elements
extends across the Web browser window.
• The background color can be defined as
background-color: color_value;
• The color value could be the CSS color name,
the hex code, or the RGB triplet.

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

13
Background Color

XP

• Setting the text color as black in a CSS rule
ensures the text will be displayed as black.

• Style rules are added to the xxx.css style sheet
and then this file is linked to the index.htm
Web page.
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

14
The link Element

XP

• After linking the external style sheet to the
Web page, the styles are applied to the
elements in the Web page.
• One style sheet can be linked to many Web
pages.
• More than one style sheet can be linked to the
Web page.
• The link element is used to link an external
style sheet to a Web page.
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

15
The link Element

XP

• The link element is placed in the head section
of the HTML code:
<link href = "url"
rel = "stylesheet"
type = "text/css" />
• url refers to the URL of the external style sheet
file.
• rel = "stylesheet" identifies this link
item as a style sheet.
• type = "text/css" identifies it as a CSS
text file.
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

16
The link Element

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

XP

17
Defining a Style for Links

XP

• By default, links are underlined and blue.
• You can change the color of the links using the
color property.

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

18
Changing the Page Background

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

XP

19
Font Families

XP

• A font is the recognizable, distinct design of a
collection of characters in a particular typeface.
• A font family is a set of fonts that have similar
characteristics.
• A generic font attempts to duplicate as many
features of a specific font as possible.
• There are five generic fonts used in Web page
design: serif, sans-serif, monospace, cursive,
and fantasy.
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

20
Font Families

•
•
•
•
•
•

XP

Generic fonts are designed to be cross-platform.
The letters in a serif font have finishing strokes.
A sans-serif font lacks finishing strokes.
A monospace font has a fixed letter width.
A fantasy font is artistic and decorative.
Cursive fonts resemble handwritten letters.

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

21
Web-safe Fonts

XP

• Web-safe fonts are displayed reliably in most
Web browsers on most devices.

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

22
The font-family Property

XP

• The font-family property is used to
change the typeface of text:
font-family: Font1, Font2, . . . ,
GenericFont;

• The most common font-family style
properties:

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

23
Setting the Font Size

XP

• The style used to change the font size:
font-size: size;
• The font size can be expressed in:
–
–
–
–
–
–
–
–
–

centimeters (cm)
inches (in)
millimeters (mm)
points (pt)
picas (pc)
pixels (px)
x-height (ex)
em
percentages

absolute units

relative units

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

24
Setting the Font Size

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

XP

25
Transforming Text

XP

• Many browsers can transform text to all
uppercase characters using the texttransform property.
• The property’s values are:
– capitalize (Text Appears With The First Letter
Of Each Word Capitalized)
– lowercase (text appears in lowercase)
– uppercase (TEXT APPEARS IN ALL CAPS)
– none (removes any of the preceding values)
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

26
Creating a Spread Heading

XP

• The letter-spacing property controls the
amount of white space between letters:
letter-spacing: letter_spacing_value;

• The word-spacing property controls the amount
of white space between words:
word-spacing: word_spacing_value;

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

27
Indenting Text

XP

• Use the text-indent property to indent
the first line of paragraph text:
text-indent: value;

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

28
Adjusting the Line Height

XP

• Single and double spacing are examples of line
height, which is the vertical spacing between
lines of text.
• By default, Web browsers use 1.0em or 1.2em
line height.
• The style used is: line-height: value;

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

29
Using the font Shorthand Property

XP

• The font property is one of several CSS shorthand
properties and is used to set a related group of
properties in one declaration.

• Values for the font properties must be listed in the
following order: font style, font weight, font variant,
font size, font family.
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

30
Text Alignment

XP

• The text-align property is used to change
the alignment of the text.
• The property’s values are:
– left – Each line of text is flush with the left margin.
– right – Each line of text is flush with the right
margin.
– center – Each line of text is centered horizontally.
– justify – Each line of text is flush with the left
and right margins.
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

31
Text Alignment

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

XP

32
Removing the Underlines on LinksXP
• Hyperlinks are underlined.
• Underline is a text decoration and can be
removed using the text-decoration
property: text-decoration: value;
• The property’s values are none, underline,
or line-through.
• The style to remove underlines on links:
a {
text-decoration: none;
}
New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

33
Some Other font Properties

XP

• To set the font style to italic, use:
font-style: italic;
• To remove italic, use:
font-style: none;
• To set the font weight to bold, use:
font-weight: bold;
• To set the font weight to light, use:
font-weight: light;

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

34
Validating the CSS Code

XP

• Navigate to http://jigsaw.w3.org/css-validator.
• Use either the ‘By file upload’ or ‘By direct
input’ method for validating a document.

New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition

35

More Related Content

What's hot

CHAPTER 1
CHAPTER 1CHAPTER 1
CHAPTER 1
Pon Tovave
 
Css tutorial
Css tutorialCss tutorial
Css tutorial
vedaste
 
HTML & CSS: Chapter 04
HTML & CSS: Chapter 04HTML & CSS: Chapter 04
HTML & CSS: Chapter 04
Steve Guinan
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
Seble Nigussie
 
Week 2
Week 2Week 2
Week 2
Rowena LI
 
Std 10 Computer Chapter 1- Introduction to HTML - Basic Formatting Tag in HT...
Std 10 Computer  Chapter 1- Introduction to HTML - Basic Formatting Tag in HT...Std 10 Computer  Chapter 1- Introduction to HTML - Basic Formatting Tag in HT...
Std 10 Computer Chapter 1- Introduction to HTML - Basic Formatting Tag in HT...
Nuzhat Memon
 
Std 10 Computer Chapter 1 introduction to HTML (Part 1)
Std 10 Computer Chapter 1  introduction to HTML (Part 1)Std 10 Computer Chapter 1  introduction to HTML (Part 1)
Std 10 Computer Chapter 1 introduction to HTML (Part 1)
Nuzhat Memon
 
Moving unstructured FrameMaker content to structure
Moving unstructured FrameMaker content to structureMoving unstructured FrameMaker content to structure
Moving unstructured FrameMaker content to structure
Publishing Smarter
 
Html5
Html5 Html5
Html5
Shiva RamDam
 
CSS Comprehensive Overview
CSS Comprehensive OverviewCSS Comprehensive Overview
CSS Comprehensive Overview
Mohamed Loey
 
Week 2 HTML lists, hyperlinks, tables, and images
Week 2 HTML lists, hyperlinks, tables, and imagesWeek 2 HTML lists, hyperlinks, tables, and images
Week 2 HTML lists, hyperlinks, tables, and images
Rowena LI
 
NOSQL and MongoDB Database
NOSQL and MongoDB DatabaseNOSQL and MongoDB Database
NOSQL and MongoDB Database
Tariqul islam
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
Seble Nigussie
 
Html basics
Html basicsHtml basics
Html basics
codegracer
 
Unit 2.1
Unit 2.1Unit 2.1
Html
HtmlHtml
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
Meghan Frisco
 
16 wordprocessing ml subject - odds and ends
16   wordprocessing ml subject - odds and ends16   wordprocessing ml subject - odds and ends
16 wordprocessing ml subject - odds and ends
Shawn Villaron
 
Css introduction
Css  introductionCss  introduction
Css introduction
vishnu murthy
 
Greenstone3building
Greenstone3buildingGreenstone3building
Greenstone3building
Juan Timoteo Cori
 

What's hot (20)

CHAPTER 1
CHAPTER 1CHAPTER 1
CHAPTER 1
 
Css tutorial
Css tutorialCss tutorial
Css tutorial
 
HTML & CSS: Chapter 04
HTML & CSS: Chapter 04HTML & CSS: Chapter 04
HTML & CSS: Chapter 04
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Week 2
Week 2Week 2
Week 2
 
Std 10 Computer Chapter 1- Introduction to HTML - Basic Formatting Tag in HT...
Std 10 Computer  Chapter 1- Introduction to HTML - Basic Formatting Tag in HT...Std 10 Computer  Chapter 1- Introduction to HTML - Basic Formatting Tag in HT...
Std 10 Computer Chapter 1- Introduction to HTML - Basic Formatting Tag in HT...
 
Std 10 Computer Chapter 1 introduction to HTML (Part 1)
Std 10 Computer Chapter 1  introduction to HTML (Part 1)Std 10 Computer Chapter 1  introduction to HTML (Part 1)
Std 10 Computer Chapter 1 introduction to HTML (Part 1)
 
Moving unstructured FrameMaker content to structure
Moving unstructured FrameMaker content to structureMoving unstructured FrameMaker content to structure
Moving unstructured FrameMaker content to structure
 
Html5
Html5 Html5
Html5
 
CSS Comprehensive Overview
CSS Comprehensive OverviewCSS Comprehensive Overview
CSS Comprehensive Overview
 
Week 2 HTML lists, hyperlinks, tables, and images
Week 2 HTML lists, hyperlinks, tables, and imagesWeek 2 HTML lists, hyperlinks, tables, and images
Week 2 HTML lists, hyperlinks, tables, and images
 
NOSQL and MongoDB Database
NOSQL and MongoDB DatabaseNOSQL and MongoDB Database
NOSQL and MongoDB Database
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
Html basics
Html basicsHtml basics
Html basics
 
Unit 2.1
Unit 2.1Unit 2.1
Unit 2.1
 
Html
HtmlHtml
Html
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
16 wordprocessing ml subject - odds and ends
16   wordprocessing ml subject - odds and ends16   wordprocessing ml subject - odds and ends
16 wordprocessing ml subject - odds and ends
 
Css introduction
Css  introductionCss  introduction
Css introduction
 
Greenstone3building
Greenstone3buildingGreenstone3building
Greenstone3building
 

Similar to Introducing Cascading Style Sheets

Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
casestudyhelp
 
Chapter 11: Intro to CSS
Chapter 11: Intro to CSSChapter 11: Intro to CSS
Chapter 11: Intro to CSS
Steve Guinan
 
Css
CssCss
Chapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSSChapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSS
Dr. Ahmed Al Zaidy
 
Css Founder.com | Cssfounder Company
Css Founder.com | Cssfounder CompanyCss Founder.com | Cssfounder Company
Css Founder.com | Cssfounder Company
Css Founder
 
Formatting Text and Links
Formatting Text and LinksFormatting Text and Links
Formatting Text and Links
Bravocash
 
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
elayelily
 
Chapter 3 - Web Design
Chapter 3 - Web DesignChapter 3 - Web Design
Chapter 3 - Web Design
tclanton4
 
CSS.pptx
CSS.pptxCSS.pptx
Week11 Lecture: CSS
Week11 Lecture: CSSWeek11 Lecture: CSS
Css
CssCss
Chapter3
Chapter3Chapter3
Chapter3
cpashke
 
Web Design Chapter3
Web Design Chapter3Web Design Chapter3
Web Design Chapter3
cpashke
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
Singsys Pte Ltd
 
CSS
CSSCSS
Ita3.2 structural and semantic element theory
Ita3.2 structural and semantic element theoryIta3.2 structural and semantic element theory
Ita3.2 structural and semantic element theory
Frank Robell
 
Styling text using css
Styling text using cssStyling text using css
Styling text using css
Daniel Francis
 
Web Engineering - Introduction to CSS
Web Engineering - Introduction to CSSWeb Engineering - Introduction to CSS
Web Engineering - Introduction to CSS
Nosheen Qamar
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
Salman Memon
 
Cascading style sheets (CSS-Web Technology)
Cascading style sheets (CSS-Web Technology)Cascading style sheets (CSS-Web Technology)
Cascading style sheets (CSS-Web Technology)
Timbal Mayank
 

Similar to Introducing Cascading Style Sheets (20)

Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
 
Chapter 11: Intro to CSS
Chapter 11: Intro to CSSChapter 11: Intro to CSS
Chapter 11: Intro to CSS
 
Css
CssCss
Css
 
Chapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSSChapter 2 Getting Started with CSS
Chapter 2 Getting Started with CSS
 
Css Founder.com | Cssfounder Company
Css Founder.com | Cssfounder CompanyCss Founder.com | Cssfounder Company
Css Founder.com | Cssfounder Company
 
Formatting Text and Links
Formatting Text and LinksFormatting Text and Links
Formatting Text and Links
 
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
 
Chapter 3 - Web Design
Chapter 3 - Web DesignChapter 3 - Web Design
Chapter 3 - Web Design
 
CSS.pptx
CSS.pptxCSS.pptx
CSS.pptx
 
Week11 Lecture: CSS
Week11 Lecture: CSSWeek11 Lecture: CSS
Week11 Lecture: CSS
 
Css
CssCss
Css
 
Chapter3
Chapter3Chapter3
Chapter3
 
Web Design Chapter3
Web Design Chapter3Web Design Chapter3
Web Design Chapter3
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
 
CSS
CSSCSS
CSS
 
Ita3.2 structural and semantic element theory
Ita3.2 structural and semantic element theoryIta3.2 structural and semantic element theory
Ita3.2 structural and semantic element theory
 
Styling text using css
Styling text using cssStyling text using css
Styling text using css
 
Web Engineering - Introduction to CSS
Web Engineering - Introduction to CSSWeb Engineering - Introduction to CSS
Web Engineering - Introduction to CSS
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
Cascading style sheets (CSS-Web Technology)
Cascading style sheets (CSS-Web Technology)Cascading style sheets (CSS-Web Technology)
Cascading style sheets (CSS-Web Technology)
 

Recently uploaded

Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 

Recently uploaded (20)

Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 

Introducing Cascading Style Sheets

  • 1. Tutorial 3 Introducing Cascading Style Sheets Blended HTML and CSS Fundamentals 3rd EDITION
  • 2. Objectives 3.1 • • • • • XP Understand the advantages of using CSS Define a style rule Apply color using CSS Create internal and external style sheets Change the appearance of a link using CSS New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 2
  • 3. Objectives 3.2 XP • Explore the five generic fonts • Understand the importance of using Web-safe fonts • Change the size and decoration properties of text • Manipulate the letter spacing, word spacing, and line height of text • Set the first line indentation and change text to uppercase using CSS • Set alignment to center text horizontally New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 3
  • 4. Introducing CSS XP • Cascading Style Sheets (CSS) is used to format Web pages. • CSS offers many advantages, including: – greater consistency in your Web page – easily modified code – more flexible formatting New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 4
  • 5. History of CSS XP • CSS1 (1996) enabled users to set font size; align text center, left, or right; set body margins; and apply background and foreground colors to page elements. • CSS2 (1998) included features such as design styles for different output devices such as print media and aural devices, and controlling the appearance and behavior of browser features. • CSS3 (2005) includes text effects such as drop shadows and Web fonts, semitransparent colors, box outlines, and rotating page elements. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 5
  • 6. Defining a Style Rule XP • Using CSS, you can change how an HTML element appears in browsers. • A style rule is the combination of a selector, a property, and a value. • The property is the name of a specific feature. • The property value provides a setting for the associated feature. • The selector identifies the element to which you are applying a style. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 6
  • 7. The Structure of a Style Rule selector { property1: value1; property2: value2; property3: value3; … } XP h1 { color: yellow; text-align: center; } • A style sheet is a collection of one or more style rules, either within an HTML document or in a separate CSS document. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 7
  • 8. Defining Color XP • 16 basic color names are standard in CSS2; a more extensive list of color names was incorporated in CSS3. color: color-value; New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 8
  • 9. Implementing Inline Styles XP • An inline style rule is a style rule that is embedded inside an HTML start tag. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 9
  • 10. Embedded Style Sheets XP • The inline style method is discouraged because the power of CSS is its ability to separate the presentation (styles) from the content. • An embedded style sheet is a set of style rules contained between the <style> start tag and the </style> end tag in the head section of an HTML document: <style type = "text/css"> style rules </style> New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 10
  • 11. Embedded Style Sheets New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition XP 11
  • 12. External Style Sheets XP • If styles are to be used across several pages in a Web site, it’s much more efficient to create a separate document that contains the styles, known as an external style sheet. • Then you should use the link element to link the external style sheet to the Web pages. • Comments should be used in style sheets to describe information about the style and to identify its sections. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 12
  • 13. Background Color XP • Background color can be defined for most elements. • The background color for heading elements extends across the Web browser window. • The background color can be defined as background-color: color_value; • The color value could be the CSS color name, the hex code, or the RGB triplet. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 13
  • 14. Background Color XP • Setting the text color as black in a CSS rule ensures the text will be displayed as black. • Style rules are added to the xxx.css style sheet and then this file is linked to the index.htm Web page. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 14
  • 15. The link Element XP • After linking the external style sheet to the Web page, the styles are applied to the elements in the Web page. • One style sheet can be linked to many Web pages. • More than one style sheet can be linked to the Web page. • The link element is used to link an external style sheet to a Web page. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 15
  • 16. The link Element XP • The link element is placed in the head section of the HTML code: <link href = "url" rel = "stylesheet" type = "text/css" /> • url refers to the URL of the external style sheet file. • rel = "stylesheet" identifies this link item as a style sheet. • type = "text/css" identifies it as a CSS text file. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 16
  • 17. The link Element New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition XP 17
  • 18. Defining a Style for Links XP • By default, links are underlined and blue. • You can change the color of the links using the color property. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 18
  • 19. Changing the Page Background New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition XP 19
  • 20. Font Families XP • A font is the recognizable, distinct design of a collection of characters in a particular typeface. • A font family is a set of fonts that have similar characteristics. • A generic font attempts to duplicate as many features of a specific font as possible. • There are five generic fonts used in Web page design: serif, sans-serif, monospace, cursive, and fantasy. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 20
  • 21. Font Families • • • • • • XP Generic fonts are designed to be cross-platform. The letters in a serif font have finishing strokes. A sans-serif font lacks finishing strokes. A monospace font has a fixed letter width. A fantasy font is artistic and decorative. Cursive fonts resemble handwritten letters. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 21
  • 22. Web-safe Fonts XP • Web-safe fonts are displayed reliably in most Web browsers on most devices. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 22
  • 23. The font-family Property XP • The font-family property is used to change the typeface of text: font-family: Font1, Font2, . . . , GenericFont; • The most common font-family style properties: New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 23
  • 24. Setting the Font Size XP • The style used to change the font size: font-size: size; • The font size can be expressed in: – – – – – – – – – centimeters (cm) inches (in) millimeters (mm) points (pt) picas (pc) pixels (px) x-height (ex) em percentages absolute units relative units New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 24
  • 25. Setting the Font Size New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition XP 25
  • 26. Transforming Text XP • Many browsers can transform text to all uppercase characters using the texttransform property. • The property’s values are: – capitalize (Text Appears With The First Letter Of Each Word Capitalized) – lowercase (text appears in lowercase) – uppercase (TEXT APPEARS IN ALL CAPS) – none (removes any of the preceding values) New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 26
  • 27. Creating a Spread Heading XP • The letter-spacing property controls the amount of white space between letters: letter-spacing: letter_spacing_value; • The word-spacing property controls the amount of white space between words: word-spacing: word_spacing_value; New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 27
  • 28. Indenting Text XP • Use the text-indent property to indent the first line of paragraph text: text-indent: value; New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 28
  • 29. Adjusting the Line Height XP • Single and double spacing are examples of line height, which is the vertical spacing between lines of text. • By default, Web browsers use 1.0em or 1.2em line height. • The style used is: line-height: value; New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 29
  • 30. Using the font Shorthand Property XP • The font property is one of several CSS shorthand properties and is used to set a related group of properties in one declaration. • Values for the font properties must be listed in the following order: font style, font weight, font variant, font size, font family. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 30
  • 31. Text Alignment XP • The text-align property is used to change the alignment of the text. • The property’s values are: – left – Each line of text is flush with the left margin. – right – Each line of text is flush with the right margin. – center – Each line of text is centered horizontally. – justify – Each line of text is flush with the left and right margins. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 31
  • 32. Text Alignment New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition XP 32
  • 33. Removing the Underlines on LinksXP • Hyperlinks are underlined. • Underline is a text decoration and can be removed using the text-decoration property: text-decoration: value; • The property’s values are none, underline, or line-through. • The style to remove underlines on links: a { text-decoration: none; } New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 33
  • 34. Some Other font Properties XP • To set the font style to italic, use: font-style: italic; • To remove italic, use: font-style: none; • To set the font weight to bold, use: font-weight: bold; • To set the font weight to light, use: font-weight: light; New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 34
  • 35. Validating the CSS Code XP • Navigate to http://jigsaw.w3.org/css-validator. • Use either the ‘By file upload’ or ‘By direct input’ method for validating a document. New Perspectives on Blended HTML and CSS Fundamentals, 3rd Edition 35