SlideShare a Scribd company logo
2
Most read
3
Most read
13
Most read
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;}

More Related Content

PPTX
Css pseudo-classes
Webtech Learning
 
PPTX
Complete Lecture on Css presentation
Salman Memon
 
PPTX
Cascading style sheets (CSS-Web Technology)
Timbal Mayank
 
PPTX
PHP FUNCTIONS
Zeeshan Ahmed
 
PPTX
CSS Transitions, Transforms, Animations
Rob LaPlaca
 
PPTX
What is CSS?
HalaiHansaika
 
Css pseudo-classes
Webtech Learning
 
Complete Lecture on Css presentation
Salman Memon
 
Cascading style sheets (CSS-Web Technology)
Timbal Mayank
 
PHP FUNCTIONS
Zeeshan Ahmed
 
CSS Transitions, Transforms, Animations
Rob LaPlaca
 
What is CSS?
HalaiHansaika
 

What's hot (20)

PPTX
Stack project
Amr Aboelgood
 
PPTX
Html list.
RUKHSARSHAIKH19
 
PPTX
Php Tutorial
pratik tambekar
 
PPTX
Css
Hemant Saini
 
PDF
CSS media types
Russ Weakley
 
PPT
Cascading Style Sheets (CSS) help
casestudyhelp
 
PPT
Java layoutmanager
Arati Gadgil
 
PPTX
Html tables
Er. Nawaraj Bhandari
 
PPSX
Javascript variables and datatypes
Varun C M
 
PPT
Control Structures In Php 2
Digital Insights - Digital Marketing Agency
 
PPT
PHP - Introduction to File Handling with PHP
Vibrant Technologies & Computers
 
PPTX
Cascading style sheets (CSS)
Harshita Yadav
 
PDF
CSS Day: CSS Grid Layout
Rachel Andrew
 
PPTX
Css selectors
Parth Trivedi
 
PPTX
Css font properties
Jesus Obenita Jr.
 
PDF
Python programming : Arrays
Emertxe Information Technologies Pvt Ltd
 
PPTX
Beginners css tutorial for web designers
Singsys Pte Ltd
 
PPTX
Html formatting
Webtech Learning
 
PPT
Ch17 Hashing
leminhvuong
 
PDF
Introduction to CSS3
Seble Nigussie
 
Stack project
Amr Aboelgood
 
Html list.
RUKHSARSHAIKH19
 
Php Tutorial
pratik tambekar
 
CSS media types
Russ Weakley
 
Cascading Style Sheets (CSS) help
casestudyhelp
 
Java layoutmanager
Arati Gadgil
 
Javascript variables and datatypes
Varun C M
 
Control Structures In Php 2
Digital Insights - Digital Marketing Agency
 
PHP - Introduction to File Handling with PHP
Vibrant Technologies & Computers
 
Cascading style sheets (CSS)
Harshita Yadav
 
CSS Day: CSS Grid Layout
Rachel Andrew
 
Css selectors
Parth Trivedi
 
Css font properties
Jesus Obenita Jr.
 
Python programming : Arrays
Emertxe Information Technologies Pvt Ltd
 
Beginners css tutorial for web designers
Singsys Pte Ltd
 
Html formatting
Webtech Learning
 
Ch17 Hashing
leminhvuong
 
Introduction to CSS3
Seble Nigussie
 
Ad

Similar to Cascading Style Sheet (20)

PDF
CSS notes
Rajendra Prasad
 
DOC
Css introduction
vishnu murthy
 
PDF
Css
actacademy
 
DOCX
Css
actacademy
 
PPTX
properties of css.pptx power pointpresentation
Coderkids
 
PPTX
4_css_intro.pptx. this ppt is based on css which is the required of web deve...
sindwanigripsi
 
PPTX
Cascading style sheet, CSS Box model, Table in CSS
SherinRappai
 
PPTX
CSS_Day_ONE (W3schools)
Rafi Haidari
 
PPTX
v5-introduction to html-css-210321161444.pptx
hannahroseline2
 
PPTX
v5-introduction to html-css-210321161444.pptx
hannahroseline2
 
PPTX
html-css
Dhirendra Chauhan
 
PPTX
Introduction to CSS
Folasade Adedeji
 
PDF
TUTORIAL DE CSS 2.0
Vladimir Valencia
 
PPTX
Lecture-6.pptx
vishal choudhary
 
PDF
CSS.pdf
SoniaJoshi25
 
PDF
Web app development_html_css_03
Hassen Poreya
 
PPT
working with internet technologies using CSS
nazimsattar
 
PDF
CSS Foundations, pt 1
Shawn Calvert
 
PPTX
Unitegergergegegegetgegegegegegeg-2-CSS.pptx
VikasTuwar1
 
PDF
Web Design Course: CSS lecture 1
Gheyath M. Othman
 
CSS notes
Rajendra Prasad
 
Css introduction
vishnu murthy
 
properties of css.pptx power pointpresentation
Coderkids
 
4_css_intro.pptx. this ppt is based on css which is the required of web deve...
sindwanigripsi
 
Cascading style sheet, CSS Box model, Table in CSS
SherinRappai
 
CSS_Day_ONE (W3schools)
Rafi Haidari
 
v5-introduction to html-css-210321161444.pptx
hannahroseline2
 
v5-introduction to html-css-210321161444.pptx
hannahroseline2
 
Introduction to CSS
Folasade Adedeji
 
TUTORIAL DE CSS 2.0
Vladimir Valencia
 
Lecture-6.pptx
vishal choudhary
 
CSS.pdf
SoniaJoshi25
 
Web app development_html_css_03
Hassen Poreya
 
working with internet technologies using CSS
nazimsattar
 
CSS Foundations, pt 1
Shawn Calvert
 
Unitegergergegegegetgegegegegegeg-2-CSS.pptx
VikasTuwar1
 
Web Design Course: CSS lecture 1
Gheyath M. Othman
 
Ad

More from Meenakshi Paul (20)

PPT
Introduction to Artificial Intelligences
Meenakshi Paul
 
PPTX
Binary Arithmetic
Meenakshi Paul
 
PPTX
19 Network Layer Protocols
Meenakshi Paul
 
PPT
Other Wireless Networks
Meenakshi Paul
 
PPTX
Wireless LANs
Meenakshi Paul
 
PPTX
Wired LANs
Meenakshi Paul
 
PPTX
Codes
Meenakshi Paul
 
PPTX
Number System
Meenakshi Paul
 
PPTX
Media Access Control (MAC Layer)
Meenakshi Paul
 
PPTX
Data Link Control
Meenakshi Paul
 
PPTX
Introduction to the Data Link Layer
Meenakshi Paul
 
PPT
Switching
Meenakshi Paul
 
PPTX
Transmission Media
Meenakshi Paul
 
PPTX
Bandwidth Utilization Multiplexing and Spectrum Spreading
Meenakshi Paul
 
PPTX
IP classes
Meenakshi Paul
 
PPT
Theory building
Meenakshi Paul
 
PPT
Information Systems and Knowledge Management
Meenakshi Paul
 
PPT
Ch01 The Role of Business Research
Meenakshi Paul
 
PPTX
05 analog transmission
Meenakshi Paul
 
PPTX
04 digital transmission
Meenakshi Paul
 
Introduction to Artificial Intelligences
Meenakshi Paul
 
Binary Arithmetic
Meenakshi Paul
 
19 Network Layer Protocols
Meenakshi Paul
 
Other Wireless Networks
Meenakshi Paul
 
Wireless LANs
Meenakshi Paul
 
Wired LANs
Meenakshi Paul
 
Number System
Meenakshi Paul
 
Media Access Control (MAC Layer)
Meenakshi Paul
 
Data Link Control
Meenakshi Paul
 
Introduction to the Data Link Layer
Meenakshi Paul
 
Switching
Meenakshi Paul
 
Transmission Media
Meenakshi Paul
 
Bandwidth Utilization Multiplexing and Spectrum Spreading
Meenakshi Paul
 
IP classes
Meenakshi Paul
 
Theory building
Meenakshi Paul
 
Information Systems and Knowledge Management
Meenakshi Paul
 
Ch01 The Role of Business Research
Meenakshi Paul
 
05 analog transmission
Meenakshi Paul
 
04 digital transmission
Meenakshi Paul
 

Recently uploaded (20)

PPTX
Virus sequence retrieval from NCBI database
yamunaK13
 
PPTX
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
PPTX
How to Apply for a Job From Odoo 18 Website
Celine George
 
PPTX
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PPTX
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PDF
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PPTX
Basics and rules of probability with real-life uses
ravatkaran694
 
Virus sequence retrieval from NCBI database
yamunaK13
 
Sonnet 130_ My Mistress’ Eyes Are Nothing Like the Sun By William Shakespear...
DhatriParmar
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
How to Apply for a Job From Odoo 18 Website
Celine George
 
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
An introduction to Prepositions for beginners.pptx
drsiddhantnagine
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
Basics and rules of probability with real-life uses
ravatkaran694
 

Cascading Style Sheet

  • 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;}