SlideShare a Scribd company logo
Cascading Style Sheets (CSS)
Mrs.C.Santhiya
Assistant Professor
TCE,Madurai.
Motivation
 Consistent look.
 Multiple platforms
 Division of labor
 User control
Style Sheet Languages
Cascading Style Sheets (CSS)
Extensible Style sheet Language (XSL)
 Often used to transform one XML document to
another form, but can also add style.
CSS Introduction
A styled HTML document
produced by the style sheet style1.css:
CSS Introduction
link element associates style sheet with doc.
CSS Introduction
type attribute specifies style language used
CSS Introduction
href attribute provides style sheet URL
CSS Introduction
title attribute provides style sheet name
CSS Introduction
Alternative, user selectable style sheets
can be specified
CSS Introduction
CSS Introduction
A styled HTML document
produced by the style sheet style2.css:
CSS Introduction
Single document can be displayed on
multiple media platforms by tailoring style
sheets:
This document will be printed differently than
it is displayed.
CSS Syntax
Parts of a style rule (or statement)
CSS Syntax:
Selector Strings
Single element type:
Multiple element types:
All element types:
Specific elements by id:
CSS Syntax:
Selector Strings
Elements belonging to a style class:
 Referencing a style class in HTML:
Elements of a certain type and class:
class selector: begins with a period .
CSS Syntax:
Selector Strings
Elements belonging to a style class:
 Referencing a style class in HTML:
Elements of a certain type and class:
this span belongs to three style classes
CSS Syntax:
Selector Strings
Elements belonging to a style class:
 Referencing a style class in HTML:
Elements of a certain type and class:
this rule applies only to span’s belonging to class special
CSS Syntax:
Selector Strings
Source anchor elements:
Element types that are descendents:
pseudo-classes
CSS Syntax:
Selector Strings
Source anchor elements:
Element types that are descendants:
rule applies to li element that is
CSS Syntax:
Selector Strings
Source anchor elements:
Element types that are descendants:
rule applies to li element that is
part of the content of an ol element
CSS Syntax:
Selector Strings
Source anchor elements:
Element types that are descendants:
rule applies to li element that is
part of the content of an ol element
that is part of the content of a ul element
Style Sheets and HTML
CSS Rule Cascade
Specificity:
1.style attribute
2.rule with selector:
1. ID
2. class/pseudo-class
3. descendant/element type
4. universal
3.HTML attribute
CSS Inheritance
CSS Inheritance
Property values:
 Specified: value contained in declaration
 Absolute: value can be determined without reference
to context (e.g., 2cm)
 Relative: value depends on context (e.g., larger)
 Computed (e.g., larger might be 1.2 x parent
font size)
 Actual: value actually used by browser (e.g.,
computed value might be rounded)
CSS Font Properties
Computed value
of font-size
property
CSS Font Properties
font-size:
 Percentage (of parent font-size)
 Absolute size keyword: xx-small, x-small,
small, medium (initial value), large,
x-large, xx-large
 User agent specific; should differ by ~ 20%
 Relative size keyword: smaller, larger
 Relative to parent element’s font
CSS Font Properties
Text is rendered using line boxes
Height of line box given by line-height
 Initial value: normal (i.e., cell height; relationship with
em height is font-specific)
 Other values (following are equivalent):
CSS Font Properties
CSS Font Properties
font shortcut property:
Initial values used if no value specified in font
property list (that is, potentially reset)
CSS Text Formatting
CSS Text Color
CSS Text Color
CSS Box Model
Every rendered element occupies a box:
(or inner edge)
(or outer edge)
CSS Box Model
CSS Box Model
CSS Box Model
CSS Box Model
Backgrounds
<body style="background-image:url('CucumberFlowerPot.png')">
Normal Flow Layout
Block
elements
only
Normal Flow Layout
html
body
div d1
div d2
div d3
div d4
Top edges of
block boxes are
in document order
Normal Flow Layout
Centering can be achieved by setting
both margins to auto
Beyond Normal Flow
CSS allows for boxes to be positioned
outside the normal flow:
 Relative positioning
span’s shifted backwards relative to normal flow
Beyond Normal Flow
CSS allows for boxes to be positioned
outside the normal flow:
 Float positioning
span taken out of normal
flow and “floated” to the
left of its line box
Beyond Normal Flow
CSS allows for boxes to be positioned
outside the normal flow:
 Absolute positioning
span’s removed from
normal flow and
positioned relative
to another box
Beyond Normal Flow
Properties used to specify positioning:
 position: static (initial value),
relative, or absolute
 Element is positioned if this property not static
 Properties left, right, top, bottom apply to
positioned elements
 Primary values are auto (initial value) or CSS length
 float: none, left, or right
 Applies to elements with static and relative
positioning only
Beyond Normal Flow
Float positioning
 Specify value for float property
Beyond Normal Flow
Absolute positioning
 Specify location for corner of box relative to
positioned containing block
margin area
padding area
containing
block
This second paragraph has a
note.
p elements are positioned (but don’t move!)
Beyond Normal Flow
Absolute positioning
 Specify location for edges of box relative to
positioned containing block
Beyond Normal Flow
Absolute positioning
10em padding top
edge
padding left
edge
Beyond Normal Flow
Absolute positioning
8em

More Related Content

What's hot (20)

PPT
Cascading Style Sheets (CSS) help
casestudyhelp
 
PPT
Css Ppt
Hema Prasanth
 
PPTX
Introduction to HTML and CSS
Ferdous Mahmud Shaon
 
PDF
Html frames
eShikshak
 
PPT
Html tag
NIRMAL FELIX
 
PPTX
Lecture 2 introduction to html
palhaftab
 
PPT
Introduction to CSS
Amit Tyagi
 
PPTX
Complete Lecture on Css presentation
Salman Memon
 
PPTX
Html
Nisa Soomro
 
PPTX
(Fast) Introduction to HTML & CSS
Dave Kelly
 
PPTX
Event In JavaScript
ShahDhruv21
 
PPT
Introduction to Cascading Style Sheets (CSS)
Chris Poteet
 
PPTX
html-table
Dhirendra Chauhan
 
PPTX
Beginners css tutorial for web designers
Singsys Pte Ltd
 
PPT
CSS Introduction
Swati Sharma
 
PPTX
Cascading style sheets (CSS)
Harshita Yadav
 
PPTX
css.ppt
bhasula
 
Cascading Style Sheets (CSS) help
casestudyhelp
 
Css Ppt
Hema Prasanth
 
Introduction to HTML and CSS
Ferdous Mahmud Shaon
 
Html frames
eShikshak
 
Html tag
NIRMAL FELIX
 
Lecture 2 introduction to html
palhaftab
 
Introduction to CSS
Amit Tyagi
 
Complete Lecture on Css presentation
Salman Memon
 
(Fast) Introduction to HTML & CSS
Dave Kelly
 
Event In JavaScript
ShahDhruv21
 
Introduction to Cascading Style Sheets (CSS)
Chris Poteet
 
html-table
Dhirendra Chauhan
 
Beginners css tutorial for web designers
Singsys Pte Ltd
 
CSS Introduction
Swati Sharma
 
Cascading style sheets (CSS)
Harshita Yadav
 
css.ppt
bhasula
 

Similar to Css lecture notes (20)

PPTX
Css1
teach4uin
 
PPT
3 css essentials
Anchu S
 
PPT
3-CSS_essentials.ppt
scet315
 
PPT
CSS Essentials for Website Development.ppt
unknownman23570
 
PPT
3-CSS_essentials_developers_begineers.ppt
mohamed abd elrazek
 
PPT
3-CSS_essentials.ppt
datapro2
 
PPT
3-CSS_essentials introduction slides.ppt
Aasma13
 
PPT
cascading style sheet in web design .ppt
lekhacce
 
PPTX
Presentation on CSS, Style Sheet, Types of Styles, Types of Text Formatting, ...
SripathiRavi1
 
PDF
CSS.pdf
ssuseraa1a80
 
PPTX
Web engineering
Syed Nouman Ali Shah
 
PPTX
Cascading Style Sheets
Senthil Kumar
 
PPT
Css class-01
Md Ali Hossain
 
PDF
cdocumentsandsettingsstudentdesktopnewfolderhtmlcss-100220030010-phpapp01.pdf
hinalsomani93
 
PDF
Chapter 3 - CSS.pdf
wubiederebe1
 
PDF
4. Web Technology CSS Basics-1
Jyoti Yadav
 
PPTX
uptu web technology unit 2 Css
Abhishek Kesharwani
 
PPT
Cascading style sheets
Jafar Nesargi
 
PPT
Cascading style sheets
Jafar Nesargi
 
PPTX
Chapter 11: Intro to CSS
Steve Guinan
 
Css1
teach4uin
 
3 css essentials
Anchu S
 
3-CSS_essentials.ppt
scet315
 
CSS Essentials for Website Development.ppt
unknownman23570
 
3-CSS_essentials_developers_begineers.ppt
mohamed abd elrazek
 
3-CSS_essentials.ppt
datapro2
 
3-CSS_essentials introduction slides.ppt
Aasma13
 
cascading style sheet in web design .ppt
lekhacce
 
Presentation on CSS, Style Sheet, Types of Styles, Types of Text Formatting, ...
SripathiRavi1
 
CSS.pdf
ssuseraa1a80
 
Web engineering
Syed Nouman Ali Shah
 
Cascading Style Sheets
Senthil Kumar
 
Css class-01
Md Ali Hossain
 
cdocumentsandsettingsstudentdesktopnewfolderhtmlcss-100220030010-phpapp01.pdf
hinalsomani93
 
Chapter 3 - CSS.pdf
wubiederebe1
 
4. Web Technology CSS Basics-1
Jyoti Yadav
 
uptu web technology unit 2 Css
Abhishek Kesharwani
 
Cascading style sheets
Jafar Nesargi
 
Cascading style sheets
Jafar Nesargi
 
Chapter 11: Intro to CSS
Steve Guinan
 
Ad

More from Santhiya Grace (10)

PPT
Xml p5 Lecture Notes
Santhiya Grace
 
PPT
Xml p4 Lecture Notes
Santhiya Grace
 
PPT
Xml p3 -Lecture Notes
Santhiya Grace
 
PPT
Xml p2 Lecture Notes
Santhiya Grace
 
PPT
Xml Lecture Notes
Santhiya Grace
 
PPT
Php Lecture Notes
Santhiya Grace
 
PPT
Ajax Lecture Notes
Santhiya Grace
 
PPT
Events Lecture Notes
Santhiya Grace
 
PPT
Software Quality Assurance
Santhiya Grace
 
PPT
Software Quality Assurance class 1
Santhiya Grace
 
Xml p5 Lecture Notes
Santhiya Grace
 
Xml p4 Lecture Notes
Santhiya Grace
 
Xml p3 -Lecture Notes
Santhiya Grace
 
Xml p2 Lecture Notes
Santhiya Grace
 
Xml Lecture Notes
Santhiya Grace
 
Php Lecture Notes
Santhiya Grace
 
Ajax Lecture Notes
Santhiya Grace
 
Events Lecture Notes
Santhiya Grace
 
Software Quality Assurance
Santhiya Grace
 
Software Quality Assurance class 1
Santhiya Grace
 
Ad

Recently uploaded (20)

PDF
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
PDF
Submit Your Papers-International Journal on Cybernetics & Informatics ( IJCI)
IJCI JOURNAL
 
PPTX
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
PPTX
Water Resources Engineering (CVE 728)--Slide 3.pptx
mohammedado3
 
PDF
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
 
PDF
aAn_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
PDF
Design Thinking basics for Engineers.pdf
CMR University
 
PPTX
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
PPTX
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
PPTX
Final Major project a b c d e f g h i j k l m
bharathpsnab
 
PDF
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
PDF
MODULE-5 notes [BCG402-CG&V] PART-B.pdf
Alvas Institute of Engineering and technology, Moodabidri
 
PPTX
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
PPT
Testing and final inspection of a solar PV system
MuhammadSanni2
 
PDF
SERVERLESS PERSONAL TO-DO LIST APPLICATION
anushaashraf20
 
PPT
New_school_Engineering_presentation_011707.ppt
VinayKumar304579
 
PPTX
Knowledge Representation : Semantic Networks
Amity University, Patna
 
PDF
20ES1152 Programming for Problem Solving Lab Manual VRSEC.pdf
Ashutosh Satapathy
 
PDF
REINFORCEMENT LEARNING IN DECISION MAKING SEMINAR REPORT
anushaashraf20
 
PPTX
MODULE 03 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
Submit Your Papers-International Journal on Cybernetics & Informatics ( IJCI)
IJCI JOURNAL
 
Worm gear strength and wear calculation as per standard VB Bhandari Databook.
shahveer210504
 
Water Resources Engineering (CVE 728)--Slide 3.pptx
mohammedado3
 
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
 
aAn_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
Design Thinking basics for Engineers.pdf
CMR University
 
fatigue in aircraft structures-221113192308-0ad6dc8c.pptx
aviatecofficial
 
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
Final Major project a b c d e f g h i j k l m
bharathpsnab
 
Basic_Concepts_in_Clinical_Biochemistry_2018كيمياء_عملي.pdf
AdelLoin
 
MODULE-5 notes [BCG402-CG&V] PART-B.pdf
Alvas Institute of Engineering and technology, Moodabidri
 
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
Testing and final inspection of a solar PV system
MuhammadSanni2
 
SERVERLESS PERSONAL TO-DO LIST APPLICATION
anushaashraf20
 
New_school_Engineering_presentation_011707.ppt
VinayKumar304579
 
Knowledge Representation : Semantic Networks
Amity University, Patna
 
20ES1152 Programming for Problem Solving Lab Manual VRSEC.pdf
Ashutosh Satapathy
 
REINFORCEMENT LEARNING IN DECISION MAKING SEMINAR REPORT
anushaashraf20
 
MODULE 03 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 

Css lecture notes