SlideShare a Scribd company logo
CSS
• Cascading Style Sheets came about due to the
realization that the HTML language really is
geared towards structure rather than formatting.
• Thus, with a style-sheet, you remove all of your
formatting from your HTML page.
• You leave HTML to do what it does best --
structure; that is, you use HTML to define what is
a paragraph, table cell, heading, list, etc., but you
don't put any instructions inside your HTML code
as to how to display those tags
• The how goes into a separate file, the stylesheet
CSS
• The concept of a cascading style sheet (CSS) is
actually quite simple. You create a separate file
known as a stylesheet and place the formatting
there and link each HTML file to it. Here is some
sample logic you might find in a stylesheet:
• I want all of my heading 1 tags to have a drop
shadow
• I want all of my pages to have a blue background
• I want my default font to be Georgia and black
• I want my heading 2 to be Verdana, red, twice as
large as the default font, and centered on the page.
•
Why are they called
"Cascading"?
• This refers to the notion of nesting. Let's
say you have a thirty page web site and
your stylesheet indicates that the
background color on all pages is a dark
blue. What if on your index page you want
the background to be a lighter shade of
blue? You can add an inline stylesheet to
your document that overrides for this page
only the stylesheet for your entire web site.
Linking to a StyleSheet
• Associating a web page with a stylesheet is easy,
as you add just one line of code inside your page's
header:
• <link rel="stylesheet" href="mystyle.css">
• This tells the web browser to get some
information from another file and that it is a
stylesheet (link rel="stylesheet").  The next
part (href="mystyle.css") tells it the name of
the stylesheet.  You can name your
stylesheet whatever you'd like, but by
convention you always end it with a ".css".
EXAMPLE
• Using the example above, a typical header
would then look like:
• <head>
<title>This is my web page</title>
<link rel="stylesheet"
href="mystyle.css"> </head>
Stylesheets and Classes
• Here, in a simplified form, is the format of a stylesheet:
• /* My First StyleSheet */
• TAG1 {
• property1 : value;
• property2 : value;
• property2 : value;
• property2 : value;
• }
• The first difference is that stylesheet comments are enclosed in
"/*" and "*/".  You'll also notice that each tag has several
properties associated with it.  These could be such properties as
the color of the text, the font of the text, or the size of the border
around it.  Value is what you'd expect, a value (e.g. red,
Verdana, 2 pixels). 
Thus, a real stylesheet might look like this:
• /* My First StyleSheet */
• BODY {
• background-color : blue;
• font-family : Georgia, serif; color : white; }
• H1 {
• font-family : Verdana, sans-serif; font-size :
2em; }
CSS
• As you can see, the format of a stylesheet
simply attached certain styles to a particular
HTML tag. From the above, you can see
that all H1 tags will be in the font Verdana
at twice the size (em) of the default font.
Rules and Stylesheets
• A rule is a statement about one syllogistic aspect
of one or more elements
• A stylesheet is a set of one or more rules that
apply to an HTML document.
• EXAMPLE:
– H1{color:green}
– The rule above sets the color of all first-level headings
(h1
– A style sheet is a set of one or more rules that apply to
an HTML document.
Anatomy of a rule
• A rule consists of two parts:
– Selector - the part before the left curly brace
– Declaration - the part within the curly braces
Anatomy of a rule
• The selector is the link between the HTML
document and the style. It specifies what
elements are affected by the declaration
• The declaration is that part of the rule that
sets forth what the effect will be. In the
example above, the selector is h1 and the
declaration is "color: green."
Anatomy of a declaration
• A declaration has two parts separated by a
colon:
• Property - that part before the colon
• Value - that part after the colon
Anatomy of a declaration
• The property is a quality or characteristic
that something pos
• The value is a precise specification of the
property. In the example, it is "green," but it
could just as easily be blue, red, yellow, or
some other color.
Complete diagram of a Rule
• Example”

More Related Content

PDF
Html grade 11
PDF
Introduction to html
PPT
Html ppt computer
PPTX
Html notes with Examples
PPT
Html project
PDF
Html grade 11
Introduction to html
Html ppt computer
Html notes with Examples
Html project

What's hot (20)

PPT
Html basics
PPTX
Introduction to HTML
PPT
Web designing using html
PPT
PPT
BasicHTML
PPTX
Html coding
PPT
Html 1
PPTX
HTML (Web) basics for a beginner
PDF
Introduction to HTML
PPTX
Web Page Designing
PPTX
Lecture 2 introduction to html
PPT
Intro Html
PPTX
HTML Fundamentals
PDF
Html - Tutorial
PPTX
Presentation html
PPTX
Basic HTML
PPT
Introduction to html
PPTX
Html basics
Introduction to HTML
Web designing using html
BasicHTML
Html coding
Html 1
HTML (Web) basics for a beginner
Introduction to HTML
Web Page Designing
Lecture 2 introduction to html
Intro Html
HTML Fundamentals
Html - Tutorial
Presentation html
Basic HTML
Introduction to html
Ad

Similar to Css (20)

DOC
Css introduction
PPTX
basic programming language AND HTML CSS JAVApdf
PPTX
Html and css
PPTX
cascadingstylesheets,introduction.css styles-210909054722.pptx
PPTX
Cascading style sheets
PPTX
Cascading style sheets
PDF
Introduction to css
PPT
ch04-css-basics_final.ppt
PPTX
Css inclusion
PPTX
FYBSC IT Web Programming Unit I HTML 5 & andcss
PPTX
CSS Basics part One
PPTX
CSS tutorial chapter 1
PPTX
Css types internal, external and inline (1)
PPTX
Introduction to Wed System And Technologies (1).pptx
PPTX
BITM3730 9-19.pptx
PDF
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
PDF
Css tutorial
Css introduction
basic programming language AND HTML CSS JAVApdf
Html and css
cascadingstylesheets,introduction.css styles-210909054722.pptx
Cascading style sheets
Cascading style sheets
Introduction to css
ch04-css-basics_final.ppt
Css inclusion
FYBSC IT Web Programming Unit I HTML 5 & andcss
CSS Basics part One
CSS tutorial chapter 1
Css types internal, external and inline (1)
Introduction to Wed System And Technologies (1).pptx
BITM3730 9-19.pptx
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Css tutorial
Ad

More from Cerise Anderson (9)

PPT
Copy right2
PPT
PPT
Chemical
PPT
Intro To Hardware And Software
PPT
Dw Lesson01
PPT
Dw Lesson02
PPT
Graphics
PPT
E Mail Etiquette
PPT
How Computer Viruses Work
Copy right2
Chemical
Intro To Hardware And Software
Dw Lesson01
Dw Lesson02
Graphics
E Mail Etiquette
How Computer Viruses Work

Recently uploaded (20)

PDF
Complications of Minimal Access Surgery at WLH
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Cell Structure & Organelles in detailed.
PPTX
Lesson notes of climatology university.
PDF
Insiders guide to clinical Medicine.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Cell Types and Its function , kingdom of life
PPTX
Pharma ospi slides which help in ospi learning
PDF
Pre independence Education in Inndia.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Institutional Correction lecture only . . .
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
Complications of Minimal Access Surgery at WLH
O7-L3 Supply Chain Operations - ICLT Program
Microbial disease of the cardiovascular and lymphatic systems
Cell Structure & Organelles in detailed.
Lesson notes of climatology university.
Insiders guide to clinical Medicine.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
01-Introduction-to-Information-Management.pdf
Microbial diseases, their pathogenesis and prophylaxis
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Cell Types and Its function , kingdom of life
Pharma ospi slides which help in ospi learning
Pre independence Education in Inndia.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Institutional Correction lecture only . . .
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
102 student loan defaulters named and shamed – Is someone you know on the list?

Css

  • 1. CSS • Cascading Style Sheets came about due to the realization that the HTML language really is geared towards structure rather than formatting. • Thus, with a style-sheet, you remove all of your formatting from your HTML page. • You leave HTML to do what it does best -- structure; that is, you use HTML to define what is a paragraph, table cell, heading, list, etc., but you don't put any instructions inside your HTML code as to how to display those tags • The how goes into a separate file, the stylesheet
  • 2. CSS • The concept of a cascading style sheet (CSS) is actually quite simple. You create a separate file known as a stylesheet and place the formatting there and link each HTML file to it. Here is some sample logic you might find in a stylesheet: • I want all of my heading 1 tags to have a drop shadow • I want all of my pages to have a blue background • I want my default font to be Georgia and black • I want my heading 2 to be Verdana, red, twice as large as the default font, and centered on the page. •
  • 3. Why are they called "Cascading"? • This refers to the notion of nesting. Let's say you have a thirty page web site and your stylesheet indicates that the background color on all pages is a dark blue. What if on your index page you want the background to be a lighter shade of blue? You can add an inline stylesheet to your document that overrides for this page only the stylesheet for your entire web site.
  • 4. Linking to a StyleSheet • Associating a web page with a stylesheet is easy, as you add just one line of code inside your page's header: • <link rel="stylesheet" href="mystyle.css"> • This tells the web browser to get some information from another file and that it is a stylesheet (link rel="stylesheet").  The next part (href="mystyle.css") tells it the name of the stylesheet.  You can name your stylesheet whatever you'd like, but by convention you always end it with a ".css".
  • 5. EXAMPLE • Using the example above, a typical header would then look like: • <head> <title>This is my web page</title> <link rel="stylesheet" href="mystyle.css"> </head>
  • 6. Stylesheets and Classes • Here, in a simplified form, is the format of a stylesheet: • /* My First StyleSheet */ • TAG1 { • property1 : value; • property2 : value; • property2 : value; • property2 : value; • } • The first difference is that stylesheet comments are enclosed in "/*" and "*/".  You'll also notice that each tag has several properties associated with it.  These could be such properties as the color of the text, the font of the text, or the size of the border around it.  Value is what you'd expect, a value (e.g. red, Verdana, 2 pixels). 
  • 7. Thus, a real stylesheet might look like this: • /* My First StyleSheet */ • BODY { • background-color : blue; • font-family : Georgia, serif; color : white; } • H1 { • font-family : Verdana, sans-serif; font-size : 2em; }
  • 8. CSS • As you can see, the format of a stylesheet simply attached certain styles to a particular HTML tag. From the above, you can see that all H1 tags will be in the font Verdana at twice the size (em) of the default font.
  • 9. Rules and Stylesheets • A rule is a statement about one syllogistic aspect of one or more elements • A stylesheet is a set of one or more rules that apply to an HTML document. • EXAMPLE: – H1{color:green} – The rule above sets the color of all first-level headings (h1 – A style sheet is a set of one or more rules that apply to an HTML document.
  • 10. Anatomy of a rule • A rule consists of two parts: – Selector - the part before the left curly brace – Declaration - the part within the curly braces
  • 11. Anatomy of a rule • The selector is the link between the HTML document and the style. It specifies what elements are affected by the declaration • The declaration is that part of the rule that sets forth what the effect will be. In the example above, the selector is h1 and the declaration is "color: green."
  • 12. Anatomy of a declaration • A declaration has two parts separated by a colon: • Property - that part before the colon • Value - that part after the colon
  • 13. Anatomy of a declaration • The property is a quality or characteristic that something pos • The value is a precise specification of the property. In the example, it is "green," but it could just as easily be blue, red, yellow, or some other color.
  • 14. Complete diagram of a Rule • Example”