SlideShare a Scribd company logo
1 of 12
CASCADING STYLE SHEETS (CSS)
CONTENT
1 INTRODUCTION
2 SYNTAX
3 TYPES OF CSS 3.2 INLINE STYLE SHEETS
3.3 EXTERNAL STYLE SHEETS
3.1 INTERNAL STYLE SHEETS
4 USE OF CSS
5 LIMITATIONS OF CSS
6 ADVANTAGES OF CSS
1. INTRODUCTION
Cascading Style Sheets (css) is a style sheet language used for describing the presentation of a
document written in a markup language.
Although most often used to set the visual style of web pages and user interfaces written
in HTML and XHTML, the language can be applied to any XML document, including plain
XML, SVG and XUL, and is applicable to rendering in speech, or on other media.
Along with HTML and JavaScript, CSS is a cornerstone technology used by most websites to create
visually engaging webpages, user interfaces for web applications, and user interfaces for many mobile
applications.
CSS is designed primarily to enable the separation of document content from document presentation,
including aspects such as the layout, colors, and fonts.
This separation can improve content accessibility, provide more flexibility and control in the specification
of presentation characteristics, enable multiple HTML pages to share formatting by specifying the
relevant CSS in a separate .css file, and reduce complexity and repetition in the structural content.
2. SYNTAX
CSS has a simple syntax and uses a number of English keywords to specify the names of various style
properties.
A style sheet consists of a list of rules. Each rule or rule-set consists of one or more selectors, and
a declaration block.
Selector: In CSS, selectors are used to declare which part of the markup a style applies to by matching
tags and attributes in the markup itself.
Selector may apply to:
1. Id: an identifier unique within the document
2. Class: an identifier that can annotate multiple elements in a document
Declaration Box: A declaration box consists of a list of declarations in braces. Each declaration itself
consists of a property, a colon (:), and a value. If there are multiple declarations in a block, a semi-colon
(;) must be inserted to separate each declaration.
3. TYPES OF CSS
When we create CSS style declarations, we will need to decide where to place our styles. The type of
style we create is characterized by the location we choose to place CSS styles.
Ideally we will place most of the CSS styles on an external style sheet, however there are situations
where internal and inline styles may be more appropriate than an external CSS styles.
Based on where the CSS styles are placed, CSS in defined in three types:
1. Internal Style Sheets
2. Inline Style Sheets
3. External Style Sheets
We have explained this three types in following slides.
3.1 INTERNAL STYLE SHEETS
An internal style sheet may be used if one single page has a unique style.
Internal styles are defined within the <style> element, inside the <head> section of an HTML page:
<head>
<style>
body {
background-color: linen;
}
h1 {
color: maroon;
margin-left: 40px;
}
</style>
</head>
3.2 INLINE STYLE SHEETS
An inline style may be used to apply a unique style for a single element.
To use inline styles, add the style attribute to the relevant element. The style attribute can contain any
CSS property.
The example below shows how to change the color and the left margin of a <h1> element:
<h1 style="color:blue;margin-left:30px;">This is a heading.</h1>
An inline style loses many of the advantages of a style sheet (by mixing content with presentation).
3.2 EXTERNAL STYLE SHEETS
With an external style sheet, you can change the look of an entire website by changing just one file!
Each page must include a reference to the external style sheet file inside the <link> element. The <link>
element goes inside the <head> section:
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
Here is how the "myStyle.css" looks:
body {
background-color:lightblue;
}
h1 {
color:navy;
}
4. USE OF CSS
Before CSS, nearly all of the presentational attributes of HTML documents were contained within the
HTML markup; all font colors, background styles, element alignments, borders and sizes had to be
explicitly described, often repeatedly, within the HTML.
CSS allows authors to move much of that information to another file, the style sheet, resulting in
considerably simpler HTML.
For example, under pre-CSS HTML, a heading element defined with red text would be written as:
<h1><font color=“red”>Chapter 1</font></h1>
Using CSS, the same element can be coded using style properties instead of HTML presentational
attributes:
<h1 style=“color:red;”>Chapter 1</h1>
5. LIMITATIONS OF CSS
Some noted limitations of the current capabilities of CSS include:
• electors are unable to ascend
• Cannot explicitly declare new scope independently of position
• Pseudo-class dynamic behavior not controllable
• Cannot name rules
• Cannot include styles from a rule into another rule
• Cannot target specific text without altering markup
6. ADVANTAGES OF CSS
Some noted advantages of CSS include:
• Separation of content from presentation
• Site-wide consistency
• bandwidth
• Page reformatting
• accessibility
THANK YOU

More Related Content

What's hot

Introduction to SASS
Introduction to SASSIntroduction to SASS
Introduction to SASS
Jon Dean
 
DEFINE FRAME AND FRAME SET WITH A EXAMPLE
DEFINE FRAME AND FRAME SET WITH A EXAMPLEDEFINE FRAME AND FRAME SET WITH A EXAMPLE
DEFINE FRAME AND FRAME SET WITH A EXAMPLE
Vaibhav Sinha
 

What's hot (20)

Html
HtmlHtml
Html
 
Css
CssCss
Css
 
Flexbox and Grid Layout
Flexbox and Grid LayoutFlexbox and Grid Layout
Flexbox and Grid Layout
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
 
Introduction to SASS
Introduction to SASSIntroduction to SASS
Introduction to SASS
 
CSS
CSSCSS
CSS
 
Css
CssCss
Css
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Introduction to BOOTSTRAP
Introduction to BOOTSTRAPIntroduction to BOOTSTRAP
Introduction to BOOTSTRAP
 
DEFINE FRAME AND FRAME SET WITH A EXAMPLE
DEFINE FRAME AND FRAME SET WITH A EXAMPLEDEFINE FRAME AND FRAME SET WITH A EXAMPLE
DEFINE FRAME AND FRAME SET WITH A EXAMPLE
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 
Java script
Java scriptJava script
Java script
 
Css tables
Css tablesCss tables
Css tables
 
Css Basics
Css BasicsCss Basics
Css Basics
 
MS Excel
MS ExcelMS Excel
MS Excel
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
 
CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout
 
Bootstrap 5 ppt
Bootstrap 5 pptBootstrap 5 ppt
Bootstrap 5 ppt
 
Basic Html Notes
Basic Html NotesBasic Html Notes
Basic Html Notes
 

Similar to Cascading Style Sheets (CSS)

Lecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptxLecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptx
GmachImen
 
Css introduction
Css introductionCss introduction
Css introduction
Sridhar P
 

Similar to Cascading Style Sheets (CSS) (20)

Lecture 9 CSS part 1.pptxType Classification
Lecture 9 CSS part 1.pptxType ClassificationLecture 9 CSS part 1.pptxType Classification
Lecture 9 CSS part 1.pptxType Classification
 
Lecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptxLecture 3CSS part 1.pptx
Lecture 3CSS part 1.pptx
 
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
 
CSS Training in Bangalore
CSS Training in BangaloreCSS Training in Bangalore
CSS Training in Bangalore
 
Css
CssCss
Css
 
Css
CssCss
Css
 
Chapter 3 - CSS.pdf
Chapter 3 - CSS.pdfChapter 3 - CSS.pdf
Chapter 3 - CSS.pdf
 
CSS - LinkedIn
CSS - LinkedInCSS - LinkedIn
CSS - LinkedIn
 
CSS
CSSCSS
CSS
 
Css introduction
Css introductionCss introduction
Css introduction
 
HTML to CSS Basics Exer 2.pptx
HTML to CSS Basics Exer 2.pptxHTML to CSS Basics Exer 2.pptx
HTML to CSS Basics Exer 2.pptx
 
CSS.ppt
CSS.pptCSS.ppt
CSS.ppt
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
chitra
chitrachitra
chitra
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Introduction of css
Introduction of cssIntroduction of css
Introduction of css
 
Styling of css
Styling of cssStyling of css
Styling of css
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
 
Cashcading stylesheets
Cashcading stylesheetsCashcading stylesheets
Cashcading stylesheets
 
lecture CSS 1-2_2022_2023.pptx
lecture CSS 1-2_2022_2023.pptxlecture CSS 1-2_2022_2023.pptx
lecture CSS 1-2_2022_2023.pptx
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Recently uploaded (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

Cascading Style Sheets (CSS)

  • 2. CONTENT 1 INTRODUCTION 2 SYNTAX 3 TYPES OF CSS 3.2 INLINE STYLE SHEETS 3.3 EXTERNAL STYLE SHEETS 3.1 INTERNAL STYLE SHEETS 4 USE OF CSS 5 LIMITATIONS OF CSS 6 ADVANTAGES OF CSS
  • 3. 1. INTRODUCTION Cascading Style Sheets (css) is a style sheet language used for describing the presentation of a document written in a markup language. Although most often used to set the visual style of web pages and user interfaces written in HTML and XHTML, the language can be applied to any XML document, including plain XML, SVG and XUL, and is applicable to rendering in speech, or on other media. Along with HTML and JavaScript, CSS is a cornerstone technology used by most websites to create visually engaging webpages, user interfaces for web applications, and user interfaces for many mobile applications. CSS is designed primarily to enable the separation of document content from document presentation, including aspects such as the layout, colors, and fonts. This separation can improve content accessibility, provide more flexibility and control in the specification of presentation characteristics, enable multiple HTML pages to share formatting by specifying the relevant CSS in a separate .css file, and reduce complexity and repetition in the structural content.
  • 4. 2. SYNTAX CSS has a simple syntax and uses a number of English keywords to specify the names of various style properties. A style sheet consists of a list of rules. Each rule or rule-set consists of one or more selectors, and a declaration block. Selector: In CSS, selectors are used to declare which part of the markup a style applies to by matching tags and attributes in the markup itself. Selector may apply to: 1. Id: an identifier unique within the document 2. Class: an identifier that can annotate multiple elements in a document Declaration Box: A declaration box consists of a list of declarations in braces. Each declaration itself consists of a property, a colon (:), and a value. If there are multiple declarations in a block, a semi-colon (;) must be inserted to separate each declaration.
  • 5. 3. TYPES OF CSS When we create CSS style declarations, we will need to decide where to place our styles. The type of style we create is characterized by the location we choose to place CSS styles. Ideally we will place most of the CSS styles on an external style sheet, however there are situations where internal and inline styles may be more appropriate than an external CSS styles. Based on where the CSS styles are placed, CSS in defined in three types: 1. Internal Style Sheets 2. Inline Style Sheets 3. External Style Sheets We have explained this three types in following slides.
  • 6. 3.1 INTERNAL STYLE SHEETS An internal style sheet may be used if one single page has a unique style. Internal styles are defined within the <style> element, inside the <head> section of an HTML page: <head> <style> body { background-color: linen; } h1 { color: maroon; margin-left: 40px; } </style> </head>
  • 7. 3.2 INLINE STYLE SHEETS An inline style may be used to apply a unique style for a single element. To use inline styles, add the style attribute to the relevant element. The style attribute can contain any CSS property. The example below shows how to change the color and the left margin of a <h1> element: <h1 style="color:blue;margin-left:30px;">This is a heading.</h1> An inline style loses many of the advantages of a style sheet (by mixing content with presentation).
  • 8. 3.2 EXTERNAL STYLE SHEETS With an external style sheet, you can change the look of an entire website by changing just one file! Each page must include a reference to the external style sheet file inside the <link> element. The <link> element goes inside the <head> section: <head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> Here is how the "myStyle.css" looks: body { background-color:lightblue; } h1 { color:navy; }
  • 9. 4. USE OF CSS Before CSS, nearly all of the presentational attributes of HTML documents were contained within the HTML markup; all font colors, background styles, element alignments, borders and sizes had to be explicitly described, often repeatedly, within the HTML. CSS allows authors to move much of that information to another file, the style sheet, resulting in considerably simpler HTML. For example, under pre-CSS HTML, a heading element defined with red text would be written as: <h1><font color=“red”>Chapter 1</font></h1> Using CSS, the same element can be coded using style properties instead of HTML presentational attributes: <h1 style=“color:red;”>Chapter 1</h1>
  • 10. 5. LIMITATIONS OF CSS Some noted limitations of the current capabilities of CSS include: • electors are unable to ascend • Cannot explicitly declare new scope independently of position • Pseudo-class dynamic behavior not controllable • Cannot name rules • Cannot include styles from a rule into another rule • Cannot target specific text without altering markup
  • 11. 6. ADVANTAGES OF CSS Some noted advantages of CSS include: • Separation of content from presentation • Site-wide consistency • bandwidth • Page reformatting • accessibility