SlideShare a Scribd company logo
Cascading Style Sheets
Alvin Dale Joyosa
• CSS stands for Cascading Style Sheets
• CSS describes how HTML elements are to be displayed on screen,
paper, or in other media
• CSS saves a lot of work. It can control the layout of multiple web
pages all at once
Advantage of CSS
• CSS saves time − You can write CSS once and then reuse same sheet in multiple HTML pages. You
can define a style for each HTML element and apply it to as many Web pages as you want.
• Pages load faster − If you are using CSS, you do not need to write HTML tag attributes every time.
Just write one CSS rule of a tag and apply it to all the occurrences of that tag. So less code means
faster download times.
• Easy maintenance − To make a global change, simply change the style, and all elements in all the
web pages will be updated automatically.
• Superior styles to HTML − CSS has a much wider array of attributes than HTML, so you can give a
far better look to your HTML page in comparison to HTML attributes.
• Multiple Device Compatibility − Style sheets allow content to be optimized for more than one
type of device. By using the same HTML document, different versions of a website can be
presented for handheld devices such as PDAs and cell phones or for printing.
• Global web standards − Now HTML attributes are being deprecated and it is being recommended
to use CSS. So its a good idea to start using CSS in all the HTML pages to make them compatible to
future browsers.
Who Creates and Maintains CSS?
• CSS is created and maintained through a group of people within the
W3C called the CSS Working Group. The CSS Working Group creates
documents called specifications. When a specification has been
discussed and officially ratified by the W3C members, it becomes a
recommendation.
• These ratified specifications are called recommendations because the
W3C has no control over the actual implementation of the language.
Independent companies and organizations create that software.
• NOTE − The World Wide Web Consortium, or W3C is a group that
makes recommendations about how the Internet works and how it
should evolve.
CSS Versions
• Cascading Style Sheets level 1 (CSS1) came out of W3C as a
recommendation in December 1996. This version describes the CSS
language as well as a simple visual formatting model for all the HTML
tags.
• CSS2 became a W3C recommendation in May 1998 and builds on
CSS1. This version adds support for media-specific style sheets e.g.
printers and aural devices, downloadable fonts, element positioning
and tables.
SYNTAX
• A CSS comprises of style rules that are interpreted by the browser and
then applied to the corresponding elements in your document. A
style rule is made of three parts −
• Selector − A selector is an HTML tag at which a style will be applied.
This could be any tag like <h1> or <table> etc.
• Property − A property is a type of attribute of HTML tag. Put simply,
all the HTML attributes are converted into CSS properties. They could
be color, border etc.
• Value − Values are assigned to properties. For example, color property
can have value either red or #F1F1F1 etc.
}
CSS Syntax
• A CSS rule-set consists of a selector and a declaration block:
h1 {color : blue ; font-size: 12px;}
property:value ;
• The selector points to the HTML element you want to style.
• The declaration block contains one or more declarations separated by
semicolons.
• Each declaration includes a CSS property name and a value, separated by a colon.
• A CSS declaration always ends with a semicolon, and declaration blocks are
surrounded by curly braces.
CSS Selectors
• CSS selectors are used to "find" (or select) HTML elements based on
their element name, id, class, attribute, and more.
The element Selector
• The element selector selects elements based on the element name.
• You can select all <p> elements on a page like this (in this case, all <p>
elements will be center-aligned, with a red text color):
• p {
text-align: center;
color: red;
}
The id Selector
• The id selector uses the id attribute of an HTML element to select a specific
element.
• The id of an element should be unique within a page, so the id selector is
used to select one unique element!
• To select an element with a specific id, write a hash (#) character, followed
by the id of the element.
• The style rule below will be applied to the HTML element with id="para1":
#para1 {
text-align: center;
color: red;
}
Note: An id name cannot start with a number!
The class Selector
• The class selector selects elements with a specific class attribute.
• To select elements with a specific class, write a period (.) character,
followed by the name of the class.
• In the example below, all HTML elements with class="center" will be
red and center-aligned:
.center {
text-align: center;
color: red;
}
<html>
<head>
<style>
p.center {
text-align: center;
color: red;
}
p.large {
font-size: 300%;
}
</style>
</head>
<body>
<h1 class="center">This heading will not be affected</h1>
<p class="center">This paragraph will be red and center-aligned.</p>
<p class="center large">This paragraph will be red, center-aligned, and in a large font-size.</p>
</body>
</html>
Grouping Selectors
• If you have elements with the same style definitions,
• It will be better to group the selectors, to minimize the code.
• To group selectors, separate each selector with a comma.
• In the example below we have grouped the selectors
h1, h2, p {
text-align: center;
color: red;
}
Three Ways to Insert CSS
There are three ways of inserting a style sheet:
• External style sheet
• Internal style sheet
• Inline style
External Style Sheet
• 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>
Internal Style Sheet
• 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:
<html>
<head>
<style>
body {
background-color: linen;
}
h1 {
color: maroon;
margin-left: 40px;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
colors
• Colors are specified using predefined color names, or RGB and HEX

More Related Content

PPTX
Complete Lecture on Css presentation
PPTX
UNIT 3WOP fgfufhbuiibpvihbvpihivbhibvipuuvbiuvboi
PPTX
Unit 2 WT-CSS.pptx web technology project
PPTX
PPTX
WEB TECHNOLOGY Unit-2.pptx
PPTX
uptu web technology unit 2 Css
PPTX
Cascading Styling Sheets(CSS) simple design language intended to transform th...
Complete Lecture on Css presentation
UNIT 3WOP fgfufhbuiibpvihbvpihivbhibvipuuvbiuvboi
Unit 2 WT-CSS.pptx web technology project
WEB TECHNOLOGY Unit-2.pptx
uptu web technology unit 2 Css
Cascading Styling Sheets(CSS) simple design language intended to transform th...

Similar to Cascading Style Sheets for web browser.pptx (20)

PPTX
Lecture-6.pptx
PPTX
Introduction to Wed System And Technologies (1).pptx
PPTX
PPTX
Cascading style sheets
PPTX
Cascading style sheets
PPTX
cascadingstylesheets,introduction.css styles-210909054722.pptx
PPTX
Web Development - Lecture 5
PDF
Css tutorial
PDF
Css - Tutorial
PPTX
PPTX
DHTML stands for Dynamic Hyper Text Markup Language. DHTML is not a language ...
PPTX
Cascading style sheet, CSS Box model, Table in CSS
PDF
PPTX
Unit-3-CSS-BWT.pptx
DOCX
PPTX
PPTX
cascading style sheets- About cascading style sheets on the selectors
PDF
Csstutorial
PPTX
Introduction to CSS.pptx web for web web
Lecture-6.pptx
Introduction to Wed System And Technologies (1).pptx
Cascading style sheets
Cascading style sheets
cascadingstylesheets,introduction.css styles-210909054722.pptx
Web Development - Lecture 5
Css tutorial
Css - Tutorial
DHTML stands for Dynamic Hyper Text Markup Language. DHTML is not a language ...
Cascading style sheet, CSS Box model, Table in CSS
Unit-3-CSS-BWT.pptx
cascading style sheets- About cascading style sheets on the selectors
Csstutorial
Introduction to CSS.pptx web for web web
Ad

More from alvindalejoyosa1 (12)

PPTX
IT415sysad-First-Day-Copy for 40 char.pptx
PPTX
Capstone2-First-Day for 40 characters.pptx
PPT
1 Routing Concepts-students to download only.ppt
PPT
6992363lesson for me to download slides.ppt
PDF
lesson1-computer na malupits for download only230905075434-6af8a066%20(1).pdf
PPTX
clmssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss.pptx
PPT
2 StaticRouting-students-cisco .ppt
PPTX
4.assembly .pptx
PPTX
itEraLesson3. .pptx
PDF
professionalethics-170425143812-converted (1).pdf
PPTX
intro to animation wcc 3D MODELING .pptx
PPTX
Calculus.pptx
IT415sysad-First-Day-Copy for 40 char.pptx
Capstone2-First-Day for 40 characters.pptx
1 Routing Concepts-students to download only.ppt
6992363lesson for me to download slides.ppt
lesson1-computer na malupits for download only230905075434-6af8a066%20(1).pdf
clmssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss.pptx
2 StaticRouting-students-cisco .ppt
4.assembly .pptx
itEraLesson3. .pptx
professionalethics-170425143812-converted (1).pdf
intro to animation wcc 3D MODELING .pptx
Calculus.pptx
Ad

Recently uploaded (20)

PDF
mera desh ae watn.(a source of motivation and patriotism to the youth of the ...
PDF
The Ikigai Template _ Recalibrate How You Spend Your Time.pdf
DOCX
Unit-3 cyber security network security of internet system
PDF
Introduction to the IoT system, how the IoT system works
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
PPTX
artificialintelligenceai1-copy-210604123353.pptx
PPT
Ethics in Information System - Management Information System
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PDF
Exploring VPS Hosting Trends for SMBs in 2025
PPTX
artificial intelligence overview of it and more
PPTX
Funds Management Learning Material for Beg
PPTX
presentation_pfe-universite-molay-seltan.pptx
PPT
415456121-Jiwratrwecdtwfdsfwgdwedvwe dbwsdjsadca-EVN.ppt
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PPTX
E -tech empowerment technologies PowerPoint
PDF
Sims 4 Historia para lo sims 4 para jugar
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
mera desh ae watn.(a source of motivation and patriotism to the youth of the ...
The Ikigai Template _ Recalibrate How You Spend Your Time.pdf
Unit-3 cyber security network security of internet system
Introduction to the IoT system, how the IoT system works
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
artificialintelligenceai1-copy-210604123353.pptx
Ethics in Information System - Management Information System
Power Point - Lesson 3_2.pptx grad school presentation
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Exploring VPS Hosting Trends for SMBs in 2025
artificial intelligence overview of it and more
Funds Management Learning Material for Beg
presentation_pfe-universite-molay-seltan.pptx
415456121-Jiwratrwecdtwfdsfwgdwedvwe dbwsdjsadca-EVN.ppt
Design_with_Watersergyerge45hrbgre4top (1).ppt
E -tech empowerment technologies PowerPoint
Sims 4 Historia para lo sims 4 para jugar
INTERNET------BASICS-------UPDATED PPT PRESENTATION

Cascading Style Sheets for web browser.pptx

  • 2. • CSS stands for Cascading Style Sheets • CSS describes how HTML elements are to be displayed on screen, paper, or in other media • CSS saves a lot of work. It can control the layout of multiple web pages all at once
  • 3. Advantage of CSS • CSS saves time − You can write CSS once and then reuse same sheet in multiple HTML pages. You can define a style for each HTML element and apply it to as many Web pages as you want. • Pages load faster − If you are using CSS, you do not need to write HTML tag attributes every time. Just write one CSS rule of a tag and apply it to all the occurrences of that tag. So less code means faster download times. • Easy maintenance − To make a global change, simply change the style, and all elements in all the web pages will be updated automatically. • Superior styles to HTML − CSS has a much wider array of attributes than HTML, so you can give a far better look to your HTML page in comparison to HTML attributes. • Multiple Device Compatibility − Style sheets allow content to be optimized for more than one type of device. By using the same HTML document, different versions of a website can be presented for handheld devices such as PDAs and cell phones or for printing. • Global web standards − Now HTML attributes are being deprecated and it is being recommended to use CSS. So its a good idea to start using CSS in all the HTML pages to make them compatible to future browsers.
  • 4. Who Creates and Maintains CSS? • CSS is created and maintained through a group of people within the W3C called the CSS Working Group. The CSS Working Group creates documents called specifications. When a specification has been discussed and officially ratified by the W3C members, it becomes a recommendation. • These ratified specifications are called recommendations because the W3C has no control over the actual implementation of the language. Independent companies and organizations create that software. • NOTE − The World Wide Web Consortium, or W3C is a group that makes recommendations about how the Internet works and how it should evolve.
  • 5. CSS Versions • Cascading Style Sheets level 1 (CSS1) came out of W3C as a recommendation in December 1996. This version describes the CSS language as well as a simple visual formatting model for all the HTML tags. • CSS2 became a W3C recommendation in May 1998 and builds on CSS1. This version adds support for media-specific style sheets e.g. printers and aural devices, downloadable fonts, element positioning and tables.
  • 6. SYNTAX • A CSS comprises of style rules that are interpreted by the browser and then applied to the corresponding elements in your document. A style rule is made of three parts − • Selector − A selector is an HTML tag at which a style will be applied. This could be any tag like <h1> or <table> etc. • Property − A property is a type of attribute of HTML tag. Put simply, all the HTML attributes are converted into CSS properties. They could be color, border etc. • Value − Values are assigned to properties. For example, color property can have value either red or #F1F1F1 etc. }
  • 7. CSS Syntax • A CSS rule-set consists of a selector and a declaration block: h1 {color : blue ; font-size: 12px;} property:value ; • The selector points to the HTML element you want to style. • The declaration block contains one or more declarations separated by semicolons. • Each declaration includes a CSS property name and a value, separated by a colon. • A CSS declaration always ends with a semicolon, and declaration blocks are surrounded by curly braces.
  • 8. CSS Selectors • CSS selectors are used to "find" (or select) HTML elements based on their element name, id, class, attribute, and more.
  • 9. The element Selector • The element selector selects elements based on the element name. • You can select all <p> elements on a page like this (in this case, all <p> elements will be center-aligned, with a red text color): • p { text-align: center; color: red; }
  • 10. The id Selector • The id selector uses the id attribute of an HTML element to select a specific element. • The id of an element should be unique within a page, so the id selector is used to select one unique element! • To select an element with a specific id, write a hash (#) character, followed by the id of the element. • The style rule below will be applied to the HTML element with id="para1": #para1 { text-align: center; color: red; } Note: An id name cannot start with a number!
  • 11. The class Selector • The class selector selects elements with a specific class attribute. • To select elements with a specific class, write a period (.) character, followed by the name of the class. • In the example below, all HTML elements with class="center" will be red and center-aligned: .center { text-align: center; color: red; }
  • 12. <html> <head> <style> p.center { text-align: center; color: red; } p.large { font-size: 300%; } </style> </head> <body> <h1 class="center">This heading will not be affected</h1> <p class="center">This paragraph will be red and center-aligned.</p> <p class="center large">This paragraph will be red, center-aligned, and in a large font-size.</p> </body> </html>
  • 13. Grouping Selectors • If you have elements with the same style definitions, • It will be better to group the selectors, to minimize the code. • To group selectors, separate each selector with a comma. • In the example below we have grouped the selectors h1, h2, p { text-align: center; color: red; }
  • 14. Three Ways to Insert CSS There are three ways of inserting a style sheet: • External style sheet • Internal style sheet • Inline style
  • 15. External Style Sheet • 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>
  • 16. Internal Style Sheet • 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:
  • 17. <html> <head> <style> body { background-color: linen; } h1 { color: maroon; margin-left: 40px; } </style> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html>
  • 18. colors • Colors are specified using predefined color names, or RGB and HEX