SlideShare a Scribd company logo
Cascading style sheets (CSS)
-Varsha Kumari
2/2/2019 1
Introduction
What is CSS?
CSS stands for Cascading Style Sheets
Style sheet language
Describe the looks and formatting of a
document
Styles define how to display HTML elements
enable the separation of document content
from document presentation
2/2/2019 2
CSS Syntax
A CSS rule set consists of a selector and a
declaration block
Selector
points to the HTML element you want to style
Declaration
contains one or more declarations separated by
semicolons
includes a property name and a value, separated
by a colon
2/2/2019 3
CSS Syntax
2/2/2019 4
CSS Example
p {color: red; text-align: center; font-
size:30px; text-transform: uppercase;}
body {background-image: url(“gla.jpg");
margin-left:20px;}
td{background-color:”red” ;}
h2 { color: rgb(255,0,0); }
p { font-family: "Times New Roman“; } 5
• div {
border: 1px solid black;
margin: 100px 150px 100px 80px;
background-color: lightblue;
• }
2/2/2019 6
Three Ways to Insert CSS
Internal style sheet
Within the html document
External style sheet
As an external CSS file with .css extension
Inline style
In the same line where we want to apply the style
2/2/2019 7
Internal Style Sheet
Used when a single document has a unique
style
Defined in the head section of an HTML page
Defined within the <style> tag
Scope is up to the same document only
Every document has its own Internal CSS, if
required.
2/2/2019 8
abc.html
<html>
<head>
<style>
p {text-align: center; color: red;}
h1{color: red; text-transform: lowercase;}
</style>
</head>
<body>
<p>Every paragraph will be affected by the style.</p>
<h1Me too!</h1>
<p>And me!</p>
</body>
</html> Save it as “abc.html”
2/2/2019 9
External Style Sheet
 Ideal when the style is applied to many pages
 Changes the look of an entire Web site by
changing just one file
 Include a link to the style sheet with the
<link> tag
 <link> tag goes inside the head section
 Attributes of <link> tag:
rel
type
href
 CSS file is saved using .css extension
2/2/2019 10
External Style Sheet Example
H1 {color: red;}
H6{Color: green;}
Save it as “mystyle.css”
2/2/2019 11
External Style Sheet Example (Contd.)
<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body>
<h1> This is the biggest heading</h1>
<h6> This is the smallest heading</h6>
</body>
</html>
Save it as “abc.html”
2/2/2019 12
Inline Style Sheet
adds the style attribute to the relevant tag
style attribute can contain any CSS property
<p style="color:green;margin-left:20px; text-
transform: uppercase;” >
GLA University
</p>
Will work for only the specified tag at that line
only
2/2/2019 13
Cascading order
All the styles will "cascade" into a new
"virtual" style sheet by the following rules:
Inline style (inside an HTML element) (Highest
priority)
Internal style sheet (in the head section)
External style sheet
Browser default (Lowest priority)
2/2/2019 14
2/2/2019 15

More Related Content

What's hot (18)

PDF
CSS in HTML
Vineet Kumar Saini
 
PPT
PPT on Basic HTML Tags
VinitaPaliwal1
 
PPTX
HTML
shaiksafi1
 
PPT
902350 html jar
siva thirumal
 
PPT
Intodcution to Html
Taha Malampatti
 
PPTX
Html and its tags
Afrasiyab Haider
 
PPTX
Css
Hemant Saini
 
PPT
3.2 introduction to css
Bulldogs83
 
DOC
Css introduction
vishnu murthy
 
PPTX
Std 10 Chapter 2 Head and Body Sections in HTML (Part 2- Body section)
Nuzhat Memon
 
PPT
HTML basics
Akhil Kaushik
 
PPTX
WEB PAGE DESIGN USING HTML
Sneha Mukherjee
 
PPTX
Web Application and HTML Summary
Fernando Torres
 
PPTX
web development basics tables part2
Kalluri Vinay Reddy
 
PPTX
HTML Tutorials
Arvind Kumar
 
PPTX
Html
Noha Sayed
 
PPTX
Html
Zintle Tonyela
 
PPT
Html project
arsh7511
 
CSS in HTML
Vineet Kumar Saini
 
PPT on Basic HTML Tags
VinitaPaliwal1
 
902350 html jar
siva thirumal
 
Intodcution to Html
Taha Malampatti
 
Html and its tags
Afrasiyab Haider
 
3.2 introduction to css
Bulldogs83
 
Css introduction
vishnu murthy
 
Std 10 Chapter 2 Head and Body Sections in HTML (Part 2- Body section)
Nuzhat Memon
 
HTML basics
Akhil Kaushik
 
WEB PAGE DESIGN USING HTML
Sneha Mukherjee
 
Web Application and HTML Summary
Fernando Torres
 
web development basics tables part2
Kalluri Vinay Reddy
 
HTML Tutorials
Arvind Kumar
 
Html project
arsh7511
 

Similar to Css mod1 (20)

PPTX
CSS (Cascading Style Sheet)
Harshit Srivastava
 
PPTX
Css
veena parihar
 
PPTX
HTML to CSS Basics Exer 2.pptx
JJFajardo1
 
PPTX
CSS-ppt.pptx f df dff dfvdfv fdvfdfddf dfv df
drpreetiwctm
 
PPTX
Cascading style sheets (CSS)
Harshita Yadav
 
PPTX
cascadingstylesheets,introduction.css styles-210909054722.pptx
hannahroseline2
 
PPTX
it-150608145445-lva1-app6891Unit_3 .pptx
Shwetamaurya36
 
PPTX
CSS Basics (Cascading Style Sheet)
Ajay Khatri
 
PPTX
Cascading style sheets
smithaps4
 
PPTX
basic programming language AND HTML CSS JAVApdf
elayelily
 
PPTX
Cascading style sheets
smitha273566
 
PPTX
Introduction of css
Dinesh Kumar
 
PPT
Introduction to css by programmerblog.net
Programmer Blog
 
PPTX
CSC PPT 4.pptx
DrRavneetSingh
 
PPTX
Web technology Unit-II Part-C
SSN College of Engineering, Kalavakkam
 
PPTX
chitra
sweet chitra
 
PPT
CSS.ppt
MukulSingh293955
 
PPT
css-presentation.ppt
prathur68
 
CSS (Cascading Style Sheet)
Harshit Srivastava
 
HTML to CSS Basics Exer 2.pptx
JJFajardo1
 
CSS-ppt.pptx f df dff dfvdfv fdvfdfddf dfv df
drpreetiwctm
 
Cascading style sheets (CSS)
Harshita Yadav
 
cascadingstylesheets,introduction.css styles-210909054722.pptx
hannahroseline2
 
it-150608145445-lva1-app6891Unit_3 .pptx
Shwetamaurya36
 
CSS Basics (Cascading Style Sheet)
Ajay Khatri
 
Cascading style sheets
smithaps4
 
basic programming language AND HTML CSS JAVApdf
elayelily
 
Cascading style sheets
smitha273566
 
Introduction of css
Dinesh Kumar
 
Introduction to css by programmerblog.net
Programmer Blog
 
CSC PPT 4.pptx
DrRavneetSingh
 
Web technology Unit-II Part-C
SSN College of Engineering, Kalavakkam
 
chitra
sweet chitra
 
css-presentation.ppt
prathur68
 
Ad

More from VARSHAKUMARI49 (15)

PPT
28,29. procedures subprocedure,type checking functions in VBScript
VARSHAKUMARI49
 
PPT
30,31,32,33. decision and loop statements in vbscript
VARSHAKUMARI49
 
PPT
27. mathematical, date and time functions in VB Script
VARSHAKUMARI49
 
PPT
Cascading style sheet
VARSHAKUMARI49
 
PPT
Introduction to web technology
VARSHAKUMARI49
 
PPT
Database normalization
VARSHAKUMARI49
 
PPT
Joins
VARSHAKUMARI49
 
PPT
Sub queries
VARSHAKUMARI49
 
PPT
Introduction to sql
VARSHAKUMARI49
 
PPT
Vbscript
VARSHAKUMARI49
 
PPT
Js mod1
VARSHAKUMARI49
 
PPT
Register counters.readonly
VARSHAKUMARI49
 
PPT
Sorting.ppt read only
VARSHAKUMARI49
 
PPT
Hashing
VARSHAKUMARI49
 
28,29. procedures subprocedure,type checking functions in VBScript
VARSHAKUMARI49
 
30,31,32,33. decision and loop statements in vbscript
VARSHAKUMARI49
 
27. mathematical, date and time functions in VB Script
VARSHAKUMARI49
 
Cascading style sheet
VARSHAKUMARI49
 
Introduction to web technology
VARSHAKUMARI49
 
Database normalization
VARSHAKUMARI49
 
Sub queries
VARSHAKUMARI49
 
Introduction to sql
VARSHAKUMARI49
 
Vbscript
VARSHAKUMARI49
 
Register counters.readonly
VARSHAKUMARI49
 
Sorting.ppt read only
VARSHAKUMARI49
 
Ad

Recently uploaded (20)

DOCX
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
PPTX
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
PDF
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
PPTX
DATA BASE MANAGEMENT AND RELATIONAL DATA
gomathisankariv2
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PDF
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
PPTX
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
PPTX
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
PPTX
Server Side Web Development Unit 1 of Nodejs.pptx
sneha852132
 
PPTX
VITEEE 2026 Exam Details , Important Dates
SonaliSingh127098
 
PPTX
Green Building & Energy Conservation ppt
Sagar Sarangi
 
PDF
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
PPTX
Day2 B2 Best.pptx
helenjenefa1
 
PPTX
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
PPTX
What is Shot Peening | Shot Peening is a Surface Treatment Process
Vibra Finish
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PDF
Design Thinking basics for Engineers.pdf
CMR University
 
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
DATA BASE MANAGEMENT AND RELATIONAL DATA
gomathisankariv2
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
MRRS Strength and Durability of Concrete
CivilMythili
 
Damage of stability of a ship and how its change .pptx
ehamadulhaque
 
Element 11. ELECTRICITY safety and hazards
merrandomohandas
 
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
Server Side Web Development Unit 1 of Nodejs.pptx
sneha852132
 
VITEEE 2026 Exam Details , Important Dates
SonaliSingh127098
 
Green Building & Energy Conservation ppt
Sagar Sarangi
 
AI TECHNIQUES FOR IDENTIFYING ALTERATIONS IN THE HUMAN GUT MICROBIOME IN MULT...
vidyalalltv1
 
Day2 B2 Best.pptx
helenjenefa1
 
The Role of Information Technology in Environmental Protectio....pptx
nallamillisriram
 
What is Shot Peening | Shot Peening is a Surface Treatment Process
Vibra Finish
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
Design Thinking basics for Engineers.pdf
CMR University
 

Css mod1

  • 1. Cascading style sheets (CSS) -Varsha Kumari 2/2/2019 1
  • 2. Introduction What is CSS? CSS stands for Cascading Style Sheets Style sheet language Describe the looks and formatting of a document Styles define how to display HTML elements enable the separation of document content from document presentation 2/2/2019 2
  • 3. CSS Syntax A CSS rule set consists of a selector and a declaration block Selector points to the HTML element you want to style Declaration contains one or more declarations separated by semicolons includes a property name and a value, separated by a colon 2/2/2019 3
  • 5. CSS Example p {color: red; text-align: center; font- size:30px; text-transform: uppercase;} body {background-image: url(“gla.jpg"); margin-left:20px;} td{background-color:”red” ;} h2 { color: rgb(255,0,0); } p { font-family: "Times New Roman“; } 5
  • 6. • div { border: 1px solid black; margin: 100px 150px 100px 80px; background-color: lightblue; • } 2/2/2019 6
  • 7. Three Ways to Insert CSS Internal style sheet Within the html document External style sheet As an external CSS file with .css extension Inline style In the same line where we want to apply the style 2/2/2019 7
  • 8. Internal Style Sheet Used when a single document has a unique style Defined in the head section of an HTML page Defined within the <style> tag Scope is up to the same document only Every document has its own Internal CSS, if required. 2/2/2019 8
  • 9. abc.html <html> <head> <style> p {text-align: center; color: red;} h1{color: red; text-transform: lowercase;} </style> </head> <body> <p>Every paragraph will be affected by the style.</p> <h1Me too!</h1> <p>And me!</p> </body> </html> Save it as “abc.html” 2/2/2019 9
  • 10. External Style Sheet  Ideal when the style is applied to many pages  Changes the look of an entire Web site by changing just one file  Include a link to the style sheet with the <link> tag  <link> tag goes inside the head section  Attributes of <link> tag: rel type href  CSS file is saved using .css extension 2/2/2019 10
  • 11. External Style Sheet Example H1 {color: red;} H6{Color: green;} Save it as “mystyle.css” 2/2/2019 11
  • 12. External Style Sheet Example (Contd.) <html> <head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> <body> <h1> This is the biggest heading</h1> <h6> This is the smallest heading</h6> </body> </html> Save it as “abc.html” 2/2/2019 12
  • 13. Inline Style Sheet adds the style attribute to the relevant tag style attribute can contain any CSS property <p style="color:green;margin-left:20px; text- transform: uppercase;” > GLA University </p> Will work for only the specified tag at that line only 2/2/2019 13
  • 14. Cascading order All the styles will "cascade" into a new "virtual" style sheet by the following rules: Inline style (inside an HTML element) (Highest priority) Internal style sheet (in the head section) External style sheet Browser default (Lowest priority) 2/2/2019 14