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 Basics part One
CSS Basics part OneCSS Basics part One
CSS Basics part One
 
CSS tutorial chapter 1
CSS tutorial chapter 1CSS tutorial chapter 1
CSS tutorial chapter 1
 
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

Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 

Recently uploaded (20)

Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 

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”