SlideShare a Scribd company logo
3
Most read
4
Most read
5
Most read
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

PPTX
html-css
PPT
HTML 5 Tables and Forms
PPTX
Css pseudo-classes
PDF
Html,javascript & css
PPTX
Html n CSS
PPTX
Cascading style sheets (CSS)
PPTX
PPT
Html TAGS
html-css
HTML 5 Tables and Forms
Css pseudo-classes
Html,javascript & css
Html n CSS
Cascading style sheets (CSS)
Html TAGS

What's hot (20)

PPSX
Introduction to css
PPTX
PDF
An Introduction To HTML5
PDF
Introduction to HTML5
PPTX
PPTX
CSS
PDF
Introduction to HTML
PPT
HTML Tags
PPTX
Beginners css tutorial for web designers
PPTX
PPTX
Html ppt
PPTX
HTML Lists & Llinks
PDF
Introduction to HTML and CSS
PPTX
Html Basic Tags
PPTX
Introduction to HTML5 Canvas
PPTX
ODP
Introduction to css & its attributes with syntax
Introduction to css
An Introduction To HTML5
Introduction to HTML5
CSS
Introduction to HTML
HTML Tags
Beginners css tutorial for web designers
Html ppt
HTML Lists & Llinks
Introduction to HTML and CSS
Html Basic Tags
Introduction to HTML5 Canvas
Introduction to css & its attributes with syntax
Ad

Similar to Cascading Style Sheets (CSS) (20)

PPTX
Cascading style sheet, CSS Box model, Table in CSS
PPTX
basic programming language AND HTML CSS JAVApdf
PDF
Chapter 3 - CSS.pdf
PPTX
chitra
PDF
PPTX
UNIT 3WOP fgfufhbuiibpvihbvpihivbhibvipuuvbiuvboi
PPTX
Unit 2 WT-CSS.pptx web technology project
PPTX
v5-introduction to html-css-210321161444.pptx
PDF
cashcading style sheet note for beginares
PPT
Css siva
PPT
Css siva
PPTX
Lecture-6.pptx
PPTX
Cascading Styling Sheets(CSS) simple design language intended to transform th...
PDF
4. Web Technology CSS Basics-1
PPT
Cascading Style Sheet
PPTX
Cascading Style Sheets for web browser.pptx
PPT
Higher Computing Science CSS
PPT
Introduction to Cascading Style Sheets (CSS)
PPTX
CSS Basics (Cascading Style Sheet)
Cascading style sheet, CSS Box model, Table in CSS
basic programming language AND HTML CSS JAVApdf
Chapter 3 - CSS.pdf
chitra
UNIT 3WOP fgfufhbuiibpvihbvpihivbhibvipuuvbiuvboi
Unit 2 WT-CSS.pptx web technology project
v5-introduction to html-css-210321161444.pptx
cashcading style sheet note for beginares
Css siva
Css siva
Lecture-6.pptx
Cascading Styling Sheets(CSS) simple design language intended to transform th...
4. Web Technology CSS Basics-1
Cascading Style Sheet
Cascading Style Sheets for web browser.pptx
Higher Computing Science CSS
Introduction to Cascading Style Sheets (CSS)
CSS Basics (Cascading Style Sheet)
Ad

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
 
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
 
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
 
PDF
Modernizing your data center with Dell and AMD
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
cuic standard and advanced reporting.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
The AUB Centre for AI in Media Proposal.docx
 
Reach Out and Touch Someone: Haptics and Empathic Computing
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
MYSQL Presentation for SQL database connectivity
Chapter 3 Spatial Domain Image Processing.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
NewMind AI Monthly Chronicles - July 2025
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
 
Mobile App Security Testing_ A Comprehensive Guide.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
 
Modernizing your data center with Dell and AMD
Agricultural_Statistics_at_a_Glance_2022_0.pdf
A Presentation on Artificial Intelligence
Dropbox Q2 2025 Financial Results & Investor Presentation
cuic standard and advanced reporting.pdf
Understanding_Digital_Forensics_Presentation.pptx
Advanced methodologies resolving dimensionality complications for autism neur...

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