SlideShare a Scribd company logo
COMPUTER APPLICATIONS
CLASS X (Code 165)
TOPIC:
UNIT 2: Cascading Style Sheets
An Introduction
By
HIMANSHU PATHAK
Contents
• Introduction
• Need for CSS
• CSS Syntax
• CSS Selectors
• Types of CSS
– Inline CSS
– Internal/Embedded CSS
– External CSS
Introduction
• CSS is the language we use to style the webpage.
• CSS stands for Cascading Style Sheets.
• Now let’s try to break the acronym:
– Cascading: Falling of Styles
– Style: Adding designs/Styling our HTML tags
– Sheets: Writing our style in different documents
• CSS saves a lot of work. It can control the layout of
multiple web pages all at once.
• HTML, CSS and JavaScript are used for web
designing. It helps the web designers to apply style
on HTML tags.
Why CSS?
• CSS saves time: We can write CSS once and reuse
the same sheet in multiple HTML pages.
• Easy maintenance: To make a global change
simply change the style, and all elements in all
the webpages will be updated automatically.
• Page load faster: 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.
CSS Syntax
• A CSS Syntax rule consists of a selector, property,
and its value.
• The selector points to the HTML element where
CSS style is to be applied.
• The CSS property is separated by semicolons.
• It is a combination of selector name followed by
the property: value pair that is defined for the
specific selector.
• Selector -- h1
• Declaration -- {color : blue; font-size : 12px;}
CSS Selectors
• CSS selectors are used to "find" (or select) the
HTML elements you want to style.
• CSS selectors select HTML elements according to
its id, class, type, attribute etc.
• There are many basic different types of selectors:
– Element Selector
– Id Selector
– Class Selector
Element Selector
• The element selector selects HTML elements
based on the element name.
• Example:
p {
text-align: center;
color: red;
}
ID Selector
• The id selector uses the id attribute of an HTML
element to select a specific element.
• The id of an element is 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.
• Example:
#para1 {
text-align: center;
color: blue;
}
Class Selector
• The class selector selects HTML elements with a
specific class attribute.
• To select elements with a specific class, write a
period (.) character, followed by the class name.
• Example:
.heading {
color: green;
text-align: center;
font-size: 40px;
}
Types of CSS
• Cascading Style Sheet(CSS) is used to set the style in
web pages that contain HTML elements.
• Here "CSS types" means writing the CSS style in the
HTML document, where should it be placed on the
document? And what are the different ways to use
CSS styles?
• CSS can be added to HTML documents in 3 ways:
– Inline - by using the style attribute inside HTML elements
– Internal - by using a <style> element in
the <head> section
– External - by using a <link> element to link to an external
CSS file.
Inline CSS
• An inline CSS is used to apply a unique style to a
single HTML element.
• Managing a website may difficult if we use
only inline CSS.
• So, Whenever our requirements are very small
we can use inline CSS.
• Example:
– <p style="color : red;">This is In-line CSS .</p>
Internal CSS
• An internal CSS is used to define a style for a single
HTML page.
• The CSS rule set should be within the HTML file in
the head section i.e the CSS is embedded within the
HTML file.
• Example:
– <style>
body {background-color: yellow;}
h1 {color: blue;}
p {color: red;}
</style>
External CSS
• An external style sheet is used to define the
style for many HTML pages.
• In External CSS we create a .css file and use it in
our HTML page as per our requirements.
• The CSS is more efficient method for styling a
website. By editing the .css file, we can change
the whole site at once.
Cont…
HTML FILE
<html>
<head>
<link rel="stylesheet"
href=“styles.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
CSS FILE
body {
background-color: yellow;
}
h1 {
color: blue;
}
p {
color: red;
}
Summary
• CSS Syntax
• CSS Selector
• Types of CSS
• In the next class, we will start Unit II – Cascading
Style Sheet : Part 2 in detail.
•Thanks

More Related Content

Similar to Cascading style sheet an introduction (20)

PPTX
CSS Basics (Cascading Style Sheet)
Ajay Khatri
 
PPT
CSS.ppt
MukulSingh293955
 
PPTX
Cascading Styling Sheets(CSS) simple design language intended to transform th...
JebaRaj26
 
PPTX
Web Development - Lecture 5
Syed Shahzaib Sohail
 
PPT
CSS Training in Bangalore
rajkamal560066
 
PPTX
4_css_intro.pptx. this ppt is based on css which is the required of web deve...
sindwanigripsi
 
PPTX
Lecture 9 CSS part 1.pptxType Classification
ZahouAmel1
 
PDF
Advanced Web Programming Chapter 8
RohanMistry15
 
PPTX
INTRODUCTIONS OF CSS
SURYANARAYANBISWAL1
 
PPTX
HTML to CSS Basics Exer 2.pptx
JJFajardo1
 
PPTX
What is CSS.pptx power point presentation
Coderkids
 
PPTX
CSS (Cascading Style Sheet)
Harshit Srivastava
 
PPT
Css week11 2020 2021 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
PPT
css-presentation.ppt
prathur68
 
PPTX
Lecture 3CSS part 1.pptx
GmachImen
 
PPTX
Introduction to CSS
Shehzad Yaqoob
 
PPTX
Unit iii css and javascript 1
Jesus Obenita Jr.
 
PPTX
What is CSS?
HalaiHansaika
 
CSS Basics (Cascading Style Sheet)
Ajay Khatri
 
Cascading Styling Sheets(CSS) simple design language intended to transform th...
JebaRaj26
 
Web Development - Lecture 5
Syed Shahzaib Sohail
 
CSS Training in Bangalore
rajkamal560066
 
4_css_intro.pptx. this ppt is based on css which is the required of web deve...
sindwanigripsi
 
Lecture 9 CSS part 1.pptxType Classification
ZahouAmel1
 
Advanced Web Programming Chapter 8
RohanMistry15
 
INTRODUCTIONS OF CSS
SURYANARAYANBISWAL1
 
HTML to CSS Basics Exer 2.pptx
JJFajardo1
 
What is CSS.pptx power point presentation
Coderkids
 
CSS (Cascading Style Sheet)
Harshit Srivastava
 
Css week11 2020 2021 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
css-presentation.ppt
prathur68
 
Lecture 3CSS part 1.pptx
GmachImen
 
Introduction to CSS
Shehzad Yaqoob
 
Unit iii css and javascript 1
Jesus Obenita Jr.
 
What is CSS?
HalaiHansaika
 

More from Himanshu Pathak (18)

PPTX
Introduction to E commerce
Himanshu Pathak
 
PPTX
Digital property rights
Himanshu Pathak
 
PPTX
Intellectual property rights
Himanshu Pathak
 
PPTX
An Introduction to Cyber Ethics
Himanshu Pathak
 
PPTX
Cascading style sheet part 2
Himanshu Pathak
 
PPTX
Html multimedia
Himanshu Pathak
 
PPTX
Html forms
Himanshu Pathak
 
PPTX
Html tables
Himanshu Pathak
 
PPTX
Html link and list tags
Himanshu Pathak
 
PPTX
HTML Text formatting tags
Himanshu Pathak
 
PPTX
Basic html tags
Himanshu Pathak
 
PPTX
Introduction to html
Himanshu Pathak
 
PPTX
Mobile technologies
Himanshu Pathak
 
PPTX
Web services
Himanshu Pathak
 
PPTX
Remote Login and File Transfer Protocols
Himanshu Pathak
 
PPTX
Internet protocol
Himanshu Pathak
 
PPTX
Introduction to internet
Himanshu Pathak
 
PPTX
What is Computer?
Himanshu Pathak
 
Introduction to E commerce
Himanshu Pathak
 
Digital property rights
Himanshu Pathak
 
Intellectual property rights
Himanshu Pathak
 
An Introduction to Cyber Ethics
Himanshu Pathak
 
Cascading style sheet part 2
Himanshu Pathak
 
Html multimedia
Himanshu Pathak
 
Html forms
Himanshu Pathak
 
Html tables
Himanshu Pathak
 
Html link and list tags
Himanshu Pathak
 
HTML Text formatting tags
Himanshu Pathak
 
Basic html tags
Himanshu Pathak
 
Introduction to html
Himanshu Pathak
 
Mobile technologies
Himanshu Pathak
 
Web services
Himanshu Pathak
 
Remote Login and File Transfer Protocols
Himanshu Pathak
 
Internet protocol
Himanshu Pathak
 
Introduction to internet
Himanshu Pathak
 
What is Computer?
Himanshu Pathak
 
Ad

Recently uploaded (20)

PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PDF
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
DOCX
A summary of SPRING SILKWORMS by Mao Dun.docx
maryjosie1
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PDF
CHILD RIGHTS AND PROTECTION QUESTION BANK
Dr Raja Mohammed T
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PDF
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
PPTX
Views on Education of Indian Thinkers J.Krishnamurthy..pptx
ShrutiMahanta1
 
PPTX
Gall bladder, Small intestine and Large intestine.pptx
rekhapositivity
 
PPTX
How to Set Maximum Difference Odoo 18 POS
Celine George
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPTX
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
A summary of SPRING SILKWORMS by Mao Dun.docx
maryjosie1
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
CHILD RIGHTS AND PROTECTION QUESTION BANK
Dr Raja Mohammed T
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
Views on Education of Indian Thinkers J.Krishnamurthy..pptx
ShrutiMahanta1
 
Gall bladder, Small intestine and Large intestine.pptx
rekhapositivity
 
How to Set Maximum Difference Odoo 18 POS
Celine George
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
Dimensions of Societal Planning in Commonism
StefanMz
 
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
Ad

Cascading style sheet an introduction

  • 1. COMPUTER APPLICATIONS CLASS X (Code 165) TOPIC: UNIT 2: Cascading Style Sheets An Introduction By HIMANSHU PATHAK
  • 2. Contents • Introduction • Need for CSS • CSS Syntax • CSS Selectors • Types of CSS – Inline CSS – Internal/Embedded CSS – External CSS
  • 3. Introduction • CSS is the language we use to style the webpage. • CSS stands for Cascading Style Sheets. • Now let’s try to break the acronym: – Cascading: Falling of Styles – Style: Adding designs/Styling our HTML tags – Sheets: Writing our style in different documents • CSS saves a lot of work. It can control the layout of multiple web pages all at once. • HTML, CSS and JavaScript are used for web designing. It helps the web designers to apply style on HTML tags.
  • 4. Why CSS? • CSS saves time: We can write CSS once and reuse the same sheet in multiple HTML pages. • Easy maintenance: To make a global change simply change the style, and all elements in all the webpages will be updated automatically. • Page load faster: 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.
  • 5. CSS Syntax • A CSS Syntax rule consists of a selector, property, and its value. • The selector points to the HTML element where CSS style is to be applied. • The CSS property is separated by semicolons. • It is a combination of selector name followed by the property: value pair that is defined for the specific selector. • Selector -- h1 • Declaration -- {color : blue; font-size : 12px;}
  • 6. CSS Selectors • CSS selectors are used to "find" (or select) the HTML elements you want to style. • CSS selectors select HTML elements according to its id, class, type, attribute etc. • There are many basic different types of selectors: – Element Selector – Id Selector – Class Selector
  • 7. Element Selector • The element selector selects HTML elements based on the element name. • Example: p { text-align: center; color: red; }
  • 8. ID Selector • The id selector uses the id attribute of an HTML element to select a specific element. • The id of an element is 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. • Example: #para1 { text-align: center; color: blue; }
  • 9. Class Selector • The class selector selects HTML elements with a specific class attribute. • To select elements with a specific class, write a period (.) character, followed by the class name. • Example: .heading { color: green; text-align: center; font-size: 40px; }
  • 10. Types of CSS • Cascading Style Sheet(CSS) is used to set the style in web pages that contain HTML elements. • Here "CSS types" means writing the CSS style in the HTML document, where should it be placed on the document? And what are the different ways to use CSS styles? • CSS can be added to HTML documents in 3 ways: – Inline - by using the style attribute inside HTML elements – Internal - by using a <style> element in the <head> section – External - by using a <link> element to link to an external CSS file.
  • 11. Inline CSS • An inline CSS is used to apply a unique style to a single HTML element. • Managing a website may difficult if we use only inline CSS. • So, Whenever our requirements are very small we can use inline CSS. • Example: – <p style="color : red;">This is In-line CSS .</p>
  • 12. Internal CSS • An internal CSS is used to define a style for a single HTML page. • The CSS rule set should be within the HTML file in the head section i.e the CSS is embedded within the HTML file. • Example: – <style> body {background-color: yellow;} h1 {color: blue;} p {color: red;} </style>
  • 13. External CSS • An external style sheet is used to define the style for many HTML pages. • In External CSS we create a .css file and use it in our HTML page as per our requirements. • The CSS is more efficient method for styling a website. By editing the .css file, we can change the whole site at once.
  • 14. Cont… HTML FILE <html> <head> <link rel="stylesheet" href=“styles.css"> </head> <body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html> CSS FILE body { background-color: yellow; } h1 { color: blue; } p { color: red; }
  • 15. Summary • CSS Syntax • CSS Selector • Types of CSS • In the next class, we will start Unit II – Cascading Style Sheet : Part 2 in detail. •Thanks