SlideShare a Scribd company logo
CASCADING
STYLESHEET
What is CSS?
• Cascading Style Sheets(CSS) is a text-based
system used to specify formats.
• Cascading Style Sheets(CSS) is a stylesheet
language used for describing the look and formatting
of a document written in a markup language.
For example:-
For instance, if a CSS stylesheet specifies that level 1 heading
(<H1> tags) are to appear in green, then they will appear in
green rather than the standard black.
Advantages of CSS –
• Consistency
• Bandwidth Reduction
• Browser Compatibility
• Appearance
• Search Engine Optimization
STYLESHEET
• Stylesheet is the collection of formatting
styles(colour, size, position and other features)
which can be applied to a webpage.
• It enforces standards and uniformity
throughout a website and provide numerous
attributes to create dynamic efforts.
• Stylesheet consist of Stylerules.
STYLESRULES
• Stylerules are set of HTML text specifying the
formatting elements.
• Stylerules can be applied to selected content
of the webpage.
• Stylerules can be splited in two parts-
i. Selector
ii. Declaration
SELECTOR
• Selector is the first part of the stylerule.
• A selector is an HTML tag at which style will be
applied.
DECLARATION
• Declaration is enclosed within { }.
• Declaration has two sections seperated by
colon(:).
• The section before colon is property and the
section after colon is value.
{Property:Value}
So, the syntax of stylerule-
Selector{Declaration}
3 Ways for using Stylesheets-
1) Inline Stylesheet
2) Embedded/Internal Stylesheet
3) External Stylesheet
a) Linking to External Stylesheet
b) Importing to External Stylesheet
INLINE
STYLESHEET
• Here, the stylesheet is included within the
HTML document.
• It is implemented by using style attributes
with the HTML tag.
Syntax-
<HTML tag Style=“Property:Value”>
For example:-
<H1 style=“color:red”>WELCOME<H1>
Program for Inline Stylesheet-
The stylerule is applied to H1 tag by specifying it in the STYLE
attribute.
<HTML>
<BODY>
<H1 STYLE=“COLOR:GREEN”>This is a style
applied to H1 element</H1>
<H1>This is the default display of H1
element</H1>
</BODY>
</HTML>
OUTPUT
Drawbacks of Inline Stylesheet-
• For each element we have to implement
style seperately, if we want to style in
more than one element.
• We have to do the changes as many time
as we want at each stages.
EMBEDDED/INTERNAL
STYLESHEET
• It can be grouped using style tag instead of
applying it individually in the inline style.
Syntax-
<style> HTML tag {Property:Value}
For example:-
H1,H3,P{color:red}
Program for Inline Stylesheet-
<HTML>
<HEAD>
<STYLE>
H1{COLOR:GREEN}
H1{FONT-FAMILY:ARIAL BLACK}
H2{COLOR:RED}
H2{FONT-FAMILY:ARIAL NARROW}
</STYLE>
</HEAD>
<BODY>
<H1>This is the H1 element</H1>
<H2>This is the H2 element</H2>
<H3>This is the H3 element with its default style</H3>
</BODY>
</HTML>
OUTPUT
Drawback of Embedded Stylesheet-
• Can not be used for more than one
page styling.
Linking to the
External Stylesheet
• There may be instances that all the pages in a
website have similar settings. This can be
done by putting all the stylerules in a
stylesheet and then linking it with HTML
document.
Syntax-
<link rel=“stylesheet” type=“text/css”
href=“externalstylesheet”>
Program for Linking to external Stylesheet-
First we create .css file which has the following code-
BODY {COLOR:BLUE; FACE:COMIC}
H2 {COLOR:GREEN}
B {COLOR:RED}
The program is –
<HTML>
<HEAD>
<LINK REL="STYLESHEET" TYPE="TEXT/CSS" HREF="STYLE.CSS">
</HEAD>
<H2>This is the H2 element</H2>
<BODY>This is the body section
<P><B>This example shows the linking to an external
stylesheet</B></P>
</BODY>
</HTML>
OUTPUT
IMPORTING TO AN
EXTERNAL STYLESHEET
• Importing a stylesheet pulls a stylerule into
the document for use.
• Once imported, changes made to stylesheet
will not be reflected in the webpage into
which it has been imported.
Syntax-
<style>
@import=“stylesheetname.css”;
</style>
Program for Importing to external Stylesheet-
<HTML>
<HEAD>
<STYLE>
@IMPORT"STYLE.CSS";
</STYLE>
</HEAD>
<H2>This is the H2 element</H2>
<BODY>This is the body section
<P><B>This example shows the Importing to an external
stylesheet</B></P>
</BODY>
</HTML>
OUTPUT
SELECTOR TYPES
1) Simple selector
a) HTML selector
b) Class selector
c) Id selector
d) Universal selector
2) Contextual /Descendant selector
HTML SELECTOR
• It uses the name of the HTML element
without blank.
Syntax-
<style>
HTML tag{Property:Value}
</style}
CLASS SELECTOR
• It gives the user the ability to apply styles to
specific path of a document and not
neccesarily to the whole document.
Syntax-
<style>
.class_selector_name{Property:Value}
</style>
CLASS_SELECTOR_NAME
• Class_selector_name can be any
valid string.
• It always proceed with a dot(.)
symbol.
• It can be applied to any of the
element by using class attribute.
ID SELECTOR
• It allows the application to style to one
specific element.
Syntax-
<style>
#specific_id_name{Property:Value}
</style>
SPECIFIC_ID_NAME
• Specific_id_name can be any valid
string.
• It always proceed with a hash(#)
symbol.
• It can be applied to any of the
element by using id attribute.
UNIVERSAL
SELECTOR
• These are denoted by *.
• It is use to apply the style to all the elements
in HTML document.
Syntax-
<style>
*{Property:Value}
</style>
CONTEXTUAL/DESCEDANT
SELECTOR
• Selectors can also specify that the style should
only apply to the elements in a certain
position of the HTML document.
• It is done by listing the elements hierarchy in
the selector , with only whitespace seperating
the element names.
<SPAN> TAG
• If we want to apply special font property to
less than a whole paragraph of text, then we
use <SPAN> tag.
• It is often useful to have a word or phrase in a
line appear in different color or size.
Syntax-
<span> ________ <span>
Example
<HTML>
<HEAD>
<STYLE>
.SPANNED{SIZE:40;
FACE:ARIAL NARROW;
COLOR:RED}
</STYLE>
</HEAD>
<BODY>
This is the example of
<SPAN
CLASS="SPANNED">
SPAN</SPAN> tag
</HTML>
<DIV> TAG
• It is more convenient to apply a section of
document rather than each paragraphevery
time. It is done by <DIV> tag.
• It’s primary use is to specify presentation
details for a section or a division of a
document.
Syntax-
<div>______</div>
Example
<HTML>
<HEAD>
<STYLE>
.SPANNING{COLOR:GREEN}
</STYLE>
</HEAD>
<BODY>
<DIV CLASS="SPANNING">
<P>This is the example of
DIV tag
</DIV>
</BODY></HTML>
THANK
YOU

More Related Content

PPTX
Web Development - Lecture 6
ODP
An Introduction to Cascading Style Sheets (CSS3)
PPTX
Cascading style sheets - CSS
PPT
Cascading Style Sheets(CSS)
PPTX
introduction to CSS
PPT
Introduction to CSS
PPT
Introduction to Cascading Style Sheets (CSS)
Web Development - Lecture 6
An Introduction to Cascading Style Sheets (CSS3)
Cascading style sheets - CSS
Cascading Style Sheets(CSS)
introduction to CSS
Introduction to CSS
Introduction to Cascading Style Sheets (CSS)

What's hot (19)

PPT
Basic css
PPTX
Responsive web design with html5 and css3
PDF
PPTX
Cascading Style Sheets - CSS
PPTX
css.ppt
PPT
Css lecture notes
PPTX
Beginners css tutorial for web designers
PPTX
The three types of style sheet lesson two fourth quarter fourth year
PPTX
CSS Basics part One
PPTX
Cascading style sheets
PPTX
Introducing Cascading Style Sheets
PPTX
Css selectors
PPTX
uptu web technology unit 2 Css
PDF
CSS Selectors
PDF
Lab#5 style and selector
PPTX
1 03 - CSS Introduction
Basic css
Responsive web design with html5 and css3
Cascading Style Sheets - CSS
css.ppt
Css lecture notes
Beginners css tutorial for web designers
The three types of style sheet lesson two fourth quarter fourth year
CSS Basics part One
Cascading style sheets
Introducing Cascading Style Sheets
Css selectors
uptu web technology unit 2 Css
CSS Selectors
Lab#5 style and selector
1 03 - CSS Introduction
Ad

Viewers also liked (7)

PDF
Effective and Efficient Design with CSS3
PPS
Common Gateway Interface
PPTX
CSS Stylesheet Training
PDF
Introduction to CSS3
PDF
Fundamental CSS3
PPTX
Elements & Principles of Art Design PowerPoint
PPT
Elements And Principles of Art
Effective and Efficient Design with CSS3
Common Gateway Interface
CSS Stylesheet Training
Introduction to CSS3
Fundamental CSS3
Elements & Principles of Art Design PowerPoint
Elements And Principles of Art
Ad

Similar to CSS(Cascading Stylesheet) (20)

PDF
Cascading Style Sheets
PPTX
Cascading style sheets
PPTX
cascadingstylesheets,introduction.css styles-210909054722.pptx
PPTX
Ifi7174 lesson2
PPTX
Cascading Styling Sheets(CSS) simple design language intended to transform th...
PPTX
Unit 2 WT-CSS.pptx web technology project
PPTX
Cascading style sheet, CSS Box model, Table in CSS
PPTX
Cascading Style Sheets for web browser.pptx
PPT
6_CasCadingStylesSheetsCSS.ppt
PPTX
DOC
Css introduction
PPTX
CSS____4563276__HTML___________0989.pptx
PPTX
WEB TECHNOLOGY Unit-2.pptx
PPTX
Kick start @ css
PDF
4. Web Technology CSS Basics-1
PPTX
cascading style sheets- About cascading style sheets on the selectors
PDF
CLIENT SIDE PROGRAMMING
Cascading Style Sheets
Cascading style sheets
cascadingstylesheets,introduction.css styles-210909054722.pptx
Ifi7174 lesson2
Cascading Styling Sheets(CSS) simple design language intended to transform th...
Unit 2 WT-CSS.pptx web technology project
Cascading style sheet, CSS Box model, Table in CSS
Cascading Style Sheets for web browser.pptx
6_CasCadingStylesSheetsCSS.ppt
Css introduction
CSS____4563276__HTML___________0989.pptx
WEB TECHNOLOGY Unit-2.pptx
Kick start @ css
4. Web Technology CSS Basics-1
cascading style sheets- About cascading style sheets on the selectors
CLIENT SIDE PROGRAMMING

Recently uploaded (20)

PPT
Machine printing techniques and plangi dyeing
PPT
WHY_R12 Uaafafafpgradeaffafafafaffff.ppt
PDF
Facade & Landscape Lighting Techniques and Trends.pptx.pdf
PDF
Pongal 2026 Sponsorship Presentation - Bhopal Tamil Sangam
PPTX
Implications Existing phase plan and its feasibility.pptx
PPTX
Special finishes, classification and types, explanation
PPTX
Media And Information Literacy for Grade 12
PPT
UNIT I- Yarn, types, explanation, process
PDF
Test slideshare presentation for blog post
PPTX
YV PROFILE PROJECTS PROFILE PRES. DESIGN
PPTX
Causes of Flooding by Slidesgo sdnl;asnjdl;asj.pptx
PPTX
Tenders & Contracts Works _ Services Afzal.pptx
PPTX
rapid fire quiz in your house is your india.pptx
PDF
Emailing DDDX-MBCaEiB.pdf DDD_Europe_2022_Intro_to_Context_Mapping_pdf-165590...
PDF
Design Thinking - Module 1 - Introduction To Design Thinking - Dr. Rohan Dasg...
PDF
Urban Design Final Project-Context
PDF
ART & DESIGN HISTORY OF VEDIC CIVILISATION.pdf
PDF
Quality Control Management for RMG, Level- 4, Certificate
PPTX
Acoustics new for. Sound insulation and absorber
PDF
YOW2022-BNE-MinimalViableArchitecture.pdf
Machine printing techniques and plangi dyeing
WHY_R12 Uaafafafpgradeaffafafafaffff.ppt
Facade & Landscape Lighting Techniques and Trends.pptx.pdf
Pongal 2026 Sponsorship Presentation - Bhopal Tamil Sangam
Implications Existing phase plan and its feasibility.pptx
Special finishes, classification and types, explanation
Media And Information Literacy for Grade 12
UNIT I- Yarn, types, explanation, process
Test slideshare presentation for blog post
YV PROFILE PROJECTS PROFILE PRES. DESIGN
Causes of Flooding by Slidesgo sdnl;asnjdl;asj.pptx
Tenders & Contracts Works _ Services Afzal.pptx
rapid fire quiz in your house is your india.pptx
Emailing DDDX-MBCaEiB.pdf DDD_Europe_2022_Intro_to_Context_Mapping_pdf-165590...
Design Thinking - Module 1 - Introduction To Design Thinking - Dr. Rohan Dasg...
Urban Design Final Project-Context
ART & DESIGN HISTORY OF VEDIC CIVILISATION.pdf
Quality Control Management for RMG, Level- 4, Certificate
Acoustics new for. Sound insulation and absorber
YOW2022-BNE-MinimalViableArchitecture.pdf

CSS(Cascading Stylesheet)

  • 2. What is CSS? • Cascading Style Sheets(CSS) is a text-based system used to specify formats. • Cascading Style Sheets(CSS) is a stylesheet language used for describing the look and formatting of a document written in a markup language. For example:- For instance, if a CSS stylesheet specifies that level 1 heading (<H1> tags) are to appear in green, then they will appear in green rather than the standard black.
  • 3. Advantages of CSS – • Consistency • Bandwidth Reduction • Browser Compatibility • Appearance • Search Engine Optimization
  • 4. STYLESHEET • Stylesheet is the collection of formatting styles(colour, size, position and other features) which can be applied to a webpage. • It enforces standards and uniformity throughout a website and provide numerous attributes to create dynamic efforts. • Stylesheet consist of Stylerules.
  • 5. STYLESRULES • Stylerules are set of HTML text specifying the formatting elements. • Stylerules can be applied to selected content of the webpage. • Stylerules can be splited in two parts- i. Selector ii. Declaration
  • 6. SELECTOR • Selector is the first part of the stylerule. • A selector is an HTML tag at which style will be applied.
  • 7. DECLARATION • Declaration is enclosed within { }. • Declaration has two sections seperated by colon(:). • The section before colon is property and the section after colon is value. {Property:Value} So, the syntax of stylerule- Selector{Declaration}
  • 8. 3 Ways for using Stylesheets- 1) Inline Stylesheet 2) Embedded/Internal Stylesheet 3) External Stylesheet a) Linking to External Stylesheet b) Importing to External Stylesheet
  • 9. INLINE STYLESHEET • Here, the stylesheet is included within the HTML document. • It is implemented by using style attributes with the HTML tag. Syntax- <HTML tag Style=“Property:Value”> For example:- <H1 style=“color:red”>WELCOME<H1>
  • 10. Program for Inline Stylesheet- The stylerule is applied to H1 tag by specifying it in the STYLE attribute. <HTML> <BODY> <H1 STYLE=“COLOR:GREEN”>This is a style applied to H1 element</H1> <H1>This is the default display of H1 element</H1> </BODY> </HTML>
  • 12. Drawbacks of Inline Stylesheet- • For each element we have to implement style seperately, if we want to style in more than one element. • We have to do the changes as many time as we want at each stages.
  • 13. EMBEDDED/INTERNAL STYLESHEET • It can be grouped using style tag instead of applying it individually in the inline style. Syntax- <style> HTML tag {Property:Value} For example:- H1,H3,P{color:red}
  • 14. Program for Inline Stylesheet- <HTML> <HEAD> <STYLE> H1{COLOR:GREEN} H1{FONT-FAMILY:ARIAL BLACK} H2{COLOR:RED} H2{FONT-FAMILY:ARIAL NARROW} </STYLE> </HEAD> <BODY> <H1>This is the H1 element</H1> <H2>This is the H2 element</H2> <H3>This is the H3 element with its default style</H3> </BODY> </HTML>
  • 16. Drawback of Embedded Stylesheet- • Can not be used for more than one page styling.
  • 17. Linking to the External Stylesheet • There may be instances that all the pages in a website have similar settings. This can be done by putting all the stylerules in a stylesheet and then linking it with HTML document. Syntax- <link rel=“stylesheet” type=“text/css” href=“externalstylesheet”>
  • 18. Program for Linking to external Stylesheet- First we create .css file which has the following code- BODY {COLOR:BLUE; FACE:COMIC} H2 {COLOR:GREEN} B {COLOR:RED}
  • 19. The program is – <HTML> <HEAD> <LINK REL="STYLESHEET" TYPE="TEXT/CSS" HREF="STYLE.CSS"> </HEAD> <H2>This is the H2 element</H2> <BODY>This is the body section <P><B>This example shows the linking to an external stylesheet</B></P> </BODY> </HTML>
  • 21. IMPORTING TO AN EXTERNAL STYLESHEET • Importing a stylesheet pulls a stylerule into the document for use. • Once imported, changes made to stylesheet will not be reflected in the webpage into which it has been imported. Syntax- <style> @import=“stylesheetname.css”; </style>
  • 22. Program for Importing to external Stylesheet- <HTML> <HEAD> <STYLE> @IMPORT"STYLE.CSS"; </STYLE> </HEAD> <H2>This is the H2 element</H2> <BODY>This is the body section <P><B>This example shows the Importing to an external stylesheet</B></P> </BODY> </HTML>
  • 24. SELECTOR TYPES 1) Simple selector a) HTML selector b) Class selector c) Id selector d) Universal selector 2) Contextual /Descendant selector
  • 25. HTML SELECTOR • It uses the name of the HTML element without blank. Syntax- <style> HTML tag{Property:Value} </style}
  • 26. CLASS SELECTOR • It gives the user the ability to apply styles to specific path of a document and not neccesarily to the whole document. Syntax- <style> .class_selector_name{Property:Value} </style>
  • 27. CLASS_SELECTOR_NAME • Class_selector_name can be any valid string. • It always proceed with a dot(.) symbol. • It can be applied to any of the element by using class attribute.
  • 28. ID SELECTOR • It allows the application to style to one specific element. Syntax- <style> #specific_id_name{Property:Value} </style>
  • 29. SPECIFIC_ID_NAME • Specific_id_name can be any valid string. • It always proceed with a hash(#) symbol. • It can be applied to any of the element by using id attribute.
  • 30. UNIVERSAL SELECTOR • These are denoted by *. • It is use to apply the style to all the elements in HTML document. Syntax- <style> *{Property:Value} </style>
  • 31. CONTEXTUAL/DESCEDANT SELECTOR • Selectors can also specify that the style should only apply to the elements in a certain position of the HTML document. • It is done by listing the elements hierarchy in the selector , with only whitespace seperating the element names.
  • 32. <SPAN> TAG • If we want to apply special font property to less than a whole paragraph of text, then we use <SPAN> tag. • It is often useful to have a word or phrase in a line appear in different color or size. Syntax- <span> ________ <span>
  • 34. <DIV> TAG • It is more convenient to apply a section of document rather than each paragraphevery time. It is done by <DIV> tag. • It’s primary use is to specify presentation details for a section or a division of a document. Syntax- <div>______</div>