SlideShare uma empresa Scribd logo
1 de 20
Cascading Style Sheet
Introduction
 CSS stands for Cascading Style Sheets and is a simple
styling language which allows attaching style to HTML
elements.
 Style Sheets are templates, very similar to templates in
desktop publishing applications, containing a
collection of rules declared to various selectors
(elements).
 Cascade is a method of defining the weight
(importance) of individual styling rules thus allowing
conflicting rules to be sorted out should such rules
apply to the same selector.
Contd..
 Advantages:
 Greater typography and page layout controls
 Easier site maintenance
 The style sheet information can be stored separate from your
HTML document, and shared among many HTML files.
Change one style sheet file, and the appearance of the entire
site is updated.
 Disadvantages
 Browser compatibility must be the most common difficulty.
CSS Selector
 CSS selectors are the heart and soul of CSS.
 They define which HTML elements you are going to be
manipulating with CSS code.
 The selector name creates a direct relationship with the
HTML tag you want to edit.
 If you wanted to change the way a paragraph tag behaved,
the CSS code would look like:
 p { PROPERTY: VALUE }
 The above example is a template that you can use whenever
you are manipulating the paragraph HTML element.
Tags (Selector)
 <BODY>
 <IMG>
 <H1>… <H6>
 <FONT>
 <P>
 <FORM>
 <HR>
body {
font-family: Tahoma, Arial, sans-serif;
color: black;
background: white;
margin: 8px;
}
Selector Declaration Block
Attribute Name
Value
CSS Rule
Different Style of CSS
 Internal Style Sheet (inside the <HEAD> tag)
 External Style Sheet
 Inline Style (inside an HTML element)
Internal CSS Code
<html>
<head>
<style type="text/css">
p {color: white; }
body {background-color: black; }
</style>
</head>
<body>
<p>Your page's content!</p>
</body>
</html>
Save: “Filename.html”
External CSS
 External CSS is a file that contains only CSS code
and is saved with a ".css" file extension.
 This CSS file is then referenced in your HTML using
the <link> instead of <style>.
External CSS Code
body{ background-color: gray;}
p { color: blue; }
h3{ color: white; }
Save: “test.css”
HTML Code
<html>
<head>
<link rel="stylesheet" type="text/css" href="test.css" />
</head>
<body>
<h3> A White Header </h3>
<p> This paragraph has a blue font. The background
color of this page is gray because we changed it with
CSS! </p>
</body>
</html>
Advantages of External CSS
 It keeps your website design and content separate.
 It's much easier to reuse your CSS code if you have it
in a separate file. Instead of typing the same CSS
code on every web page you have, simply have many
pages refer to a single CSS file with the "link" tag.
 You can make drastic changes to your web pages
with just a few changes in a single CSS file.
CSS Classes
<html>
<head>
<style>
p.first { background-color: gray; }
p.second { background-color: red; }
p.third { background: purple; color: white;}
</style>
</head>
<body>
<h2>CSS Classes</h2>
<p class="first">This is the p.first paragraph</p>
<p class="second">This is the p.second paragraph</p>
<p class="third">This is the p.third paragraph</p>
</body>
</html>
CSS Background
 CSS background properties are used to define the
background effects of an element.
 CSS properties used for background effects:
 background-color
 background-image
 background-repeat
 background-position
CSS Background Properties
Property Description
background
Sets all the background properties in one
declaration
background-color Sets the background color of an element
background-image Sets the background image for an element
background-position Sets the starting position of a background image
background-repeat Sets how a background image will be repeated
 body {background-color:”red”;}
 body {background-image:url('paper.gif');}
 body
{
background-image:url('gradient2.png');
background-repeat:repeat-x;
}
 (Repeat, no-repeat, repeat-x and repeat-y)
 ol {background-position: top center; }
CSS Text
Property Description
color Sets the color of text
direction Specifies the text direction/writing direction
text-align Specifies the horizontal alignment of text
text-decoration Specifies the decoration added to text
text-indent Specifies the indentation of the first line in a text-block
text-shadow Specifies the shadow effect added to text
text-transform Controls the capitalization of text
Example
 body {color:blue;}
 h1 {text-align:center;} (right,left and justify)
 a {text-decoration:none;} (overline, line-through,
underline and blink)
 p {text-transform:uppercase;} (lowercase and
capitalize)
 p {text-indent:50px;}
CSS Font
Property Description
font Sets all the font properties in one declaration
font-family Specifies the font family for text
font-size Specifies the font size of text
font-style Specifies the font style for text
Example
 p{font-family:"Times New Roman", Times, serif;}
 p {font-style:normal;}(italic)
 p {font-size:14px;}

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
 
Css
CssCss
Css
 
CSS
CSSCSS
CSS
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)
 
Css Basics
Css BasicsCss Basics
Css Basics
 
1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
 
Week 12 CSS - Review from last week
Week 12 CSS - Review from last weekWeek 12 CSS - Review from last week
Week 12 CSS - Review from last week
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
 
Cascading Style Sheets (CSS)
Cascading Style Sheets (CSS)Cascading Style Sheets (CSS)
Cascading Style Sheets (CSS)
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
CSS
CSSCSS
CSS
 
Cascading style sheets (CSS)
Cascading style sheets (CSS)Cascading style sheets (CSS)
Cascading style sheets (CSS)
 
CSS
CSS CSS
CSS
 
Css introduction
Css  introductionCss  introduction
Css introduction
 
Css
CssCss
Css
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 
Css.html
Css.htmlCss.html
Css.html
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
 

Semelhante a CSS Guide: Learn CSS Fundamentals in 40 Steps

Semelhante a CSS Guide: Learn CSS Fundamentals in 40 Steps (20)

CSS notes
CSS notesCSS notes
CSS notes
 
Css
CssCss
Css
 
Css
CssCss
Css
 
CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)CSS_Day_ONE (W3schools)
CSS_Day_ONE (W3schools)
 
html-css
html-csshtml-css
html-css
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0
 
Lecture-6.pptx
Lecture-6.pptxLecture-6.pptx
Lecture-6.pptx
 
CSS.pdf
CSS.pdfCSS.pdf
CSS.pdf
 
CSS Foundations, pt 1
CSS Foundations, pt 1CSS Foundations, pt 1
CSS Foundations, pt 1
 
Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1
 
Unit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.pptUnit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.ppt
 
Css basics
Css basicsCss basics
Css basics
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet css
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
 
CSS - LinkedIn
CSS - LinkedInCSS - LinkedIn
CSS - LinkedIn
 
Web Design Course: CSS lecture 2
Web Design Course: CSS  lecture 2Web Design Course: CSS  lecture 2
Web Design Course: CSS lecture 2
 
Css
CssCss
Css
 
CSS
CSSCSS
CSS
 

Mais de Meenakshi Paul

Introduction to Artificial Intelligences
Introduction to Artificial IntelligencesIntroduction to Artificial Intelligences
Introduction to Artificial IntelligencesMeenakshi Paul
 
19 Network Layer Protocols
19 Network Layer Protocols19 Network Layer Protocols
19 Network Layer ProtocolsMeenakshi Paul
 
Other Wireless Networks
Other Wireless NetworksOther Wireless Networks
Other Wireless NetworksMeenakshi Paul
 
Media Access Control (MAC Layer)
Media Access Control (MAC Layer)Media Access Control (MAC Layer)
Media Access Control (MAC Layer)Meenakshi Paul
 
Introduction to the Data Link Layer
Introduction to the Data Link LayerIntroduction to the Data Link Layer
Introduction to the Data Link LayerMeenakshi Paul
 
Bandwidth Utilization Multiplexing and Spectrum Spreading
Bandwidth Utilization Multiplexing and Spectrum SpreadingBandwidth Utilization Multiplexing and Spectrum Spreading
Bandwidth Utilization Multiplexing and Spectrum SpreadingMeenakshi Paul
 
Information Systems and Knowledge Management
 Information Systems and Knowledge Management Information Systems and Knowledge Management
Information Systems and Knowledge ManagementMeenakshi Paul
 
Ch01 The Role of Business Research
Ch01 The Role of Business ResearchCh01 The Role of Business Research
Ch01 The Role of Business ResearchMeenakshi Paul
 
05 analog transmission
05 analog transmission05 analog transmission
05 analog transmissionMeenakshi Paul
 
04 digital transmission
04 digital transmission04 digital transmission
04 digital transmissionMeenakshi Paul
 

Mais de Meenakshi Paul (20)

Introduction to Artificial Intelligences
Introduction to Artificial IntelligencesIntroduction to Artificial Intelligences
Introduction to Artificial Intelligences
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
 
19 Network Layer Protocols
19 Network Layer Protocols19 Network Layer Protocols
19 Network Layer Protocols
 
Other Wireless Networks
Other Wireless NetworksOther Wireless Networks
Other Wireless Networks
 
Wireless LANs
Wireless LANsWireless LANs
Wireless LANs
 
Wired LANs
Wired LANsWired LANs
Wired LANs
 
Codes
CodesCodes
Codes
 
Number System
Number SystemNumber System
Number System
 
Media Access Control (MAC Layer)
Media Access Control (MAC Layer)Media Access Control (MAC Layer)
Media Access Control (MAC Layer)
 
Data Link Control
Data Link ControlData Link Control
Data Link Control
 
Introduction to the Data Link Layer
Introduction to the Data Link LayerIntroduction to the Data Link Layer
Introduction to the Data Link Layer
 
Switching
SwitchingSwitching
Switching
 
Transmission Media
Transmission MediaTransmission Media
Transmission Media
 
Bandwidth Utilization Multiplexing and Spectrum Spreading
Bandwidth Utilization Multiplexing and Spectrum SpreadingBandwidth Utilization Multiplexing and Spectrum Spreading
Bandwidth Utilization Multiplexing and Spectrum Spreading
 
IP classes
IP classesIP classes
IP classes
 
Theory building
Theory buildingTheory building
Theory building
 
Information Systems and Knowledge Management
 Information Systems and Knowledge Management Information Systems and Knowledge Management
Information Systems and Knowledge Management
 
Ch01 The Role of Business Research
Ch01 The Role of Business ResearchCh01 The Role of Business Research
Ch01 The Role of Business Research
 
05 analog transmission
05 analog transmission05 analog transmission
05 analog transmission
 
04 digital transmission
04 digital transmission04 digital transmission
04 digital transmission
 

Último

4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleCeline George
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1GloryAnnCastre1
 

Último (20)

4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP Module
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptxINCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
INCLUSIVE EDUCATION PRACTICES FOR TEACHERS AND TRAINERS.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1
 

CSS Guide: Learn CSS Fundamentals in 40 Steps

  • 2. Introduction  CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements.  Style Sheets are templates, very similar to templates in desktop publishing applications, containing a collection of rules declared to various selectors (elements).  Cascade is a method of defining the weight (importance) of individual styling rules thus allowing conflicting rules to be sorted out should such rules apply to the same selector.
  • 3. Contd..  Advantages:  Greater typography and page layout controls  Easier site maintenance  The style sheet information can be stored separate from your HTML document, and shared among many HTML files. Change one style sheet file, and the appearance of the entire site is updated.  Disadvantages  Browser compatibility must be the most common difficulty.
  • 4. CSS Selector  CSS selectors are the heart and soul of CSS.  They define which HTML elements you are going to be manipulating with CSS code.  The selector name creates a direct relationship with the HTML tag you want to edit.  If you wanted to change the way a paragraph tag behaved, the CSS code would look like:  p { PROPERTY: VALUE }  The above example is a template that you can use whenever you are manipulating the paragraph HTML element.
  • 5. Tags (Selector)  <BODY>  <IMG>  <H1>… <H6>  <FONT>  <P>  <FORM>  <HR>
  • 6. body { font-family: Tahoma, Arial, sans-serif; color: black; background: white; margin: 8px; } Selector Declaration Block Attribute Name Value CSS Rule
  • 7. Different Style of CSS  Internal Style Sheet (inside the <HEAD> tag)  External Style Sheet  Inline Style (inside an HTML element)
  • 8. Internal CSS Code <html> <head> <style type="text/css"> p {color: white; } body {background-color: black; } </style> </head> <body> <p>Your page's content!</p> </body> </html> Save: “Filename.html”
  • 9. External CSS  External CSS is a file that contains only CSS code and is saved with a ".css" file extension.  This CSS file is then referenced in your HTML using the <link> instead of <style>.
  • 10. External CSS Code body{ background-color: gray;} p { color: blue; } h3{ color: white; } Save: “test.css”
  • 11. HTML Code <html> <head> <link rel="stylesheet" type="text/css" href="test.css" /> </head> <body> <h3> A White Header </h3> <p> This paragraph has a blue font. The background color of this page is gray because we changed it with CSS! </p> </body> </html>
  • 12. Advantages of External CSS  It keeps your website design and content separate.  It's much easier to reuse your CSS code if you have it in a separate file. Instead of typing the same CSS code on every web page you have, simply have many pages refer to a single CSS file with the "link" tag.  You can make drastic changes to your web pages with just a few changes in a single CSS file.
  • 13. CSS Classes <html> <head> <style> p.first { background-color: gray; } p.second { background-color: red; } p.third { background: purple; color: white;} </style> </head> <body> <h2>CSS Classes</h2> <p class="first">This is the p.first paragraph</p> <p class="second">This is the p.second paragraph</p> <p class="third">This is the p.third paragraph</p> </body> </html>
  • 14. CSS Background  CSS background properties are used to define the background effects of an element.  CSS properties used for background effects:  background-color  background-image  background-repeat  background-position
  • 15. CSS Background Properties Property Description background Sets all the background properties in one declaration background-color Sets the background color of an element background-image Sets the background image for an element background-position Sets the starting position of a background image background-repeat Sets how a background image will be repeated
  • 16.  body {background-color:”red”;}  body {background-image:url('paper.gif');}  body { background-image:url('gradient2.png'); background-repeat:repeat-x; }  (Repeat, no-repeat, repeat-x and repeat-y)  ol {background-position: top center; }
  • 17. CSS Text Property Description color Sets the color of text direction Specifies the text direction/writing direction text-align Specifies the horizontal alignment of text text-decoration Specifies the decoration added to text text-indent Specifies the indentation of the first line in a text-block text-shadow Specifies the shadow effect added to text text-transform Controls the capitalization of text
  • 18. Example  body {color:blue;}  h1 {text-align:center;} (right,left and justify)  a {text-decoration:none;} (overline, line-through, underline and blink)  p {text-transform:uppercase;} (lowercase and capitalize)  p {text-indent:50px;}
  • 19. CSS Font Property Description font Sets all the font properties in one declaration font-family Specifies the font family for text font-size Specifies the font size of text font-style Specifies the font style for text
  • 20. Example  p{font-family:"Times New Roman", Times, serif;}  p {font-style:normal;}(italic)  p {font-size:14px;}