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
PDF
Lecture-3: Introduction to html - Basic Structure & Block Building
PPTX
Html, CSS & Web Designing
PPTX
Css types internal, external and inline (1)
PPTX
PPT
Web Development using HTML & CSS
PPTX
Cascading Style Sheet (CSS)
PPTX
Basic html structure
Lecture-3: Introduction to html - Basic Structure & Block Building
Html, CSS & Web Designing
Css types internal, external and inline (1)
Web Development using HTML & CSS
Cascading Style Sheet (CSS)
Basic html structure

What's hot (20)

ODP
Introduction of Html/css/js
PPTX
Css Basics
PPT
CSS for Beginners
PPTX
Javascript functions
PPSX
Javascript variables and datatypes
PPTX
Garbage collection
PPTX
Introduction to JavaScript
PPTX
Css selectors
PPTX
What is CSS?
PPTX
HTML (Web) basics for a beginner
PPTX
PPTX
Php operators
PPT
Cascading Style Sheets (CSS) help
PPTX
Css borders
PDF
JavaScript Programming
PPTX
Complete Lecture on Css presentation
PDF
Java script
PPTX
Introduction to Web Development
PPTX
Introduction of Html/css/js
Css Basics
CSS for Beginners
Javascript functions
Javascript variables and datatypes
Garbage collection
Introduction to JavaScript
Css selectors
What is CSS?
HTML (Web) basics for a beginner
Php operators
Cascading Style Sheets (CSS) help
Css borders
JavaScript Programming
Complete Lecture on Css presentation
Java script
Introduction to Web Development
Ad

Similar to Cascading Style Sheet (20)

PPTX
Cascading style sheet, CSS Box model, Table in CSS
PPTX
4_css_intro.pptx. this ppt is based on css which is the required of web deve...
PPTX
PDF
Unit 3 (it workshop).pptx
PPT
Css siva
PPT
Css siva
PPTX
v5-introduction to html-css-210321161444.pptx
PPT
Unit 2-CSS & Bootstrap.ppt
PPTX
Lecture-6.pptx
PPTX
CSS Basics part One
PPTX
CSS tutorial chapter 1
PDF
Css tutorial
PDF
4. Web Technology CSS Basics-1
PPTX
Web Programming-css.pptx
PPTX
CSS____4563276__HTML___________0989.pptx
PPTX
Cascading Styling Sheets(CSS) simple design language intended to transform th...
DOC
Css introduction
PPTX
Introduction to CSS
Cascading style sheet, CSS Box model, Table in CSS
4_css_intro.pptx. this ppt is based on css which is the required of web deve...
Unit 3 (it workshop).pptx
Css siva
Css siva
v5-introduction to html-css-210321161444.pptx
Unit 2-CSS & Bootstrap.ppt
Lecture-6.pptx
CSS Basics part One
CSS tutorial chapter 1
Css tutorial
4. Web Technology CSS Basics-1
Web Programming-css.pptx
CSS____4563276__HTML___________0989.pptx
Cascading Styling Sheets(CSS) simple design language intended to transform th...
Css introduction
Introduction to CSS
Ad

More from Meenakshi Paul (20)

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

Recently uploaded (20)

PDF
A systematic review of self-coping strategies used by university students to ...
PPTX
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
PDF
1_English_Language_Set_2.pdf probationary
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PPTX
Introduction to Building Materials
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PPTX
Unit 4 Skeletal System.ppt.pptxopresentatiom
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Hazard Identification & Risk Assessment .pdf
PDF
Complications of Minimal Access Surgery at WLH
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
A systematic review of self-coping strategies used by university students to ...
CHAPTER IV. MAN AND BIOSPHERE AND ITS TOTALITY.pptx
1_English_Language_Set_2.pdf probationary
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
Introduction to Building Materials
A powerpoint presentation on the Revised K-10 Science Shaping Paper
Unit 4 Skeletal System.ppt.pptxopresentatiom
Supply Chain Operations Speaking Notes -ICLT Program
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Hazard Identification & Risk Assessment .pdf
Complications of Minimal Access Surgery at WLH
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
LDMMIA Reiki Yoga Finals Review Spring Summer
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Orientation - ARALprogram of Deped to the Parents.pptx
Final Presentation General Medicine 03-08-2024.pptx
UNIT III MENTAL HEALTH NURSING ASSESSMENT

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