SlideShare a Scribd company logo
1 of 14
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

What's hot (20)

Html tutorials
Html tutorialsHtml tutorials
Html tutorials
 
Html basics
Html basicsHtml basics
Html basics
 
Introduction to HTML
Introduction to HTMLIntroduction to HTML
Introduction to HTML
 
Web designing using html
Web designing using htmlWeb designing using html
Web designing using html
 
Html
HtmlHtml
Html
 
BasicHTML
BasicHTMLBasicHTML
BasicHTML
 
Html coding
Html codingHtml coding
Html coding
 
Html 1
Html 1Html 1
Html 1
 
HTML (Web) basics for a beginner
HTML (Web) basics for a beginnerHTML (Web) basics for a beginner
HTML (Web) basics for a beginner
 
Introduction to HTML
Introduction to HTML Introduction to HTML
Introduction to HTML
 
Html basics NOTE
Html basics NOTEHtml basics NOTE
Html basics NOTE
 
Web Page Designing
Web Page DesigningWeb Page Designing
Web Page Designing
 
Lecture 2 introduction to html
Lecture 2  introduction to htmlLecture 2  introduction to html
Lecture 2 introduction to html
 
Intro Html
Intro HtmlIntro Html
Intro Html
 
HTML Fundamentals
HTML FundamentalsHTML Fundamentals
HTML Fundamentals
 
Html - Tutorial
Html - TutorialHtml - Tutorial
Html - Tutorial
 
Presentation html
Presentation   htmlPresentation   html
Presentation html
 
Basic HTML
Basic HTMLBasic HTML
Basic HTML
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
HTML
HTMLHTML
HTML
 

Similar to Css (20)

Css introduction
Css introductionCss introduction
Css introduction
 
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
 
Html and css
Html and cssHtml and css
Html and css
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
ch04-css-basics_final.ppt
ch04-css-basics_final.pptch04-css-basics_final.ppt
ch04-css-basics_final.ppt
 
Css inclusion
Css   inclusionCss   inclusion
Css inclusion
 
Css
CssCss
Css
 
Css
CssCss
Css
 
css.ppt
css.pptcss.ppt
css.ppt
 
FYBSC IT Web Programming Unit I HTML 5 & andcss
FYBSC IT Web Programming Unit I HTML 5 & andcssFYBSC IT Web Programming Unit I HTML 5 & andcss
FYBSC IT Web Programming Unit I HTML 5 & andcss
 
CSS tutorial chapter 1
CSS tutorial chapter 1CSS tutorial chapter 1
CSS tutorial chapter 1
 
CSS Basics part One
CSS Basics part OneCSS Basics part One
CSS Basics part One
 
Css types internal, external and inline (1)
Css types internal, external and inline (1)Css types internal, external and inline (1)
Css types internal, external and inline (1)
 
BITM3730 9-19.pptx
BITM3730 9-19.pptxBITM3730 9-19.pptx
BITM3730 9-19.pptx
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
Girl Develop It Cincinnati: Intro to HTML/CSS Class 2
 
Css tutorial
Css tutorialCss tutorial
Css tutorial
 
BITM3730 9-20.pptx
BITM3730 9-20.pptxBITM3730 9-20.pptx
BITM3730 9-20.pptx
 
Css
CssCss
Css
 

More from Cerise Anderson (9)

Copy right2
Copy right2Copy right2
Copy right2
 
Nervous
NervousNervous
Nervous
 
Chemical
ChemicalChemical
Chemical
 
Intro To Hardware And Software
Intro To Hardware And SoftwareIntro To Hardware And Software
Intro To Hardware And Software
 
Dw Lesson01
Dw Lesson01Dw Lesson01
Dw Lesson01
 
Dw Lesson02
Dw Lesson02Dw Lesson02
Dw Lesson02
 
Graphics
GraphicsGraphics
Graphics
 
E Mail Etiquette
E Mail EtiquetteE Mail Etiquette
E Mail Etiquette
 
How Computer Viruses Work
How Computer Viruses WorkHow Computer Viruses Work
How Computer Viruses Work
 

Recently uploaded

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
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
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
 
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
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
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
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 
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
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
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
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 

Recently uploaded (20)

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
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.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
 
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 ...
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
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
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
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
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 
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
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
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
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 

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”