SlideShare a Scribd company logo
1 of 27
Cascading style sheets (CSS)
-Varsha Kumari
9/9/2019 1
DHTML
• DHTML is the programming language that is
embedded in HTML and helps in creation of dynamic
web pages using a combination of the static markup
language HTML, a client side scripting language (such
as JavaScript) and the style definition language
Cascading Style Sheets.
• HTML specifies a web page’s elements like table,
frame, paragraph, list etc.
• CSS can be used for formatting some features of
those elements like element’s size, color, position
etc
9/9/2019 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
9/9/2019 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
9/9/2019 4
CSS Syntax
9/9/2019 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“; } 6
• div {
border: 1px solid black;
margin: 100px 150px 100px 80px;
background-color: lightblue;
• }
9/9/2019 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
9/9/2019 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.
9/9/2019 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”
9/9/2019 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
9/9/2019 11
External Style Sheet Example
H1 {color: red;}
H6{Color: green;}
Save it as “mystyle.css”
9/9/2019 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”
9/9/2019 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
9/9/2019 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)
9/9/2019 15
CSS Selectors
The element Selector
selects elements based on the element name
The id Selector
uses the id attribute of an HTML tag to find the specific
element
Hash (#) character, followed by the name of the id
The class Selector
finds elements with the specific class
uses the HTML class attribute
Period (.) character, followed by the name of the class
9/9/2019 16
Example of Element Selector
<html>
<head>
<style>
p {text-align: center; color: red;}
</style>
</head>
<body>
<p>Every paragraph will be affected by the style.</p>
<p id="para1">Me too!</p>
<p>And me!</p>
</body>
</html>
9/9/2019 17
Example of ID Selector
<html>
<head>
<style>
#para1 {text-align: center; color: red;}
</style>
</head>
<body>
<p id="para1">Hello World!</p>
<p>This paragraph is not affected by the style.</p>
</body>
</html>
9/9/2019 18
Another Example of ID Selector
<html>
<head>
<style>
p.center { text-align: center; color: red;}
</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>
</body>
</html>
9/9/2019 19
Example of CLASS Selector
<html>
<head>
<style>
.center { text-align: center; color: red;}
</style>
</head>
<body>
<h1 class="center">Red and center-aligned heading</h1>
<p class="center">Red and center-aligned paragraph</p>
</body>
</html>
9/9/2019 20
Another Example of CLASS Selector
<html>
<head>
<style>
p.uppercase { text-transform: uppercase;}
p.lowercase { text-transform: lowercase;}
p.capitalize { text-transform: capitalize;}
</style>
</head>
<body>
<p class="uppercase">This is some text.</p>
<p class="lowercase">This is some text.</p>
<p class="capitalize">This is some text.</p>
</body>
</html>9/9/2019 21
Contextual Selectors:
• The SPAN element gives structure and context to any
inline content in a document.
<html><head>
<style type = “text/css”>
p {background-color: rgb(200,0,255)}
p.A {background-color: rgb(250,0,255)}
.B{background-color: rgb(0,133,0)}
</style></head>
<body>
<p> welcome to </p>
<p class="A">Welcome to <span class = "B"> GLA
University</span> Mathura.</p>
<p class="B">Uttar Pradesh</p>
</body></html>9/9/2019 22
Document Object Model(DOM):
• The components of web pages are represented by objects that are
organized in hierarchical structure(parent-child relationship), called
DOM
• These objects have properties and methods that can be used to
work with web pages.
• For a script to communicate one of the objects it must know the
path through the hierarchy to reach the object, so it can call one of
the methods or set one of its property values.
• Ex
• document.form1.firstname.value
• Document.bgcolor=“lightgreen”
• Document.title=“new title is my second web page”
• Document.write(“<h1>hello</h1>”);
9/9/2019 23
Example of DOM
9/9/2019 24
Browser Object Model
• The browser object model (BOM) is a hierarchy of
browser objects that are used to manipulate methods
and properties associated with the Web browser itself.
• BOM include the window object, navigator object,
screen object, history, location object, and the
document object.
• Top of the object hierarchy is the windows object.
• The Document Object consists of objects that are used
to manipulate methods and properties of the
document or Web page loaded in the browser window.
9/9/2019 25
9/9/2019 26
9/9/2019 27

More Related Content

What's hot (19)

Css
CssCss
Css
 
Chapter 6 html
Chapter 6 htmlChapter 6 html
Chapter 6 html
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
HTML basics
HTML basicsHTML basics
HTML basics
 
Css
CssCss
Css
 
3. tutorial html web desain
3. tutorial html web desain3. tutorial html web desain
3. tutorial html web desain
 
CSS - LinkedIn
CSS - LinkedInCSS - LinkedIn
CSS - LinkedIn
 
HTML
HTMLHTML
HTML
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
Html
HtmlHtml
Html
 
HTML Tutorials
HTML TutorialsHTML Tutorials
HTML Tutorials
 
Web Page Designing Using HTML
Web Page Designing Using HTMLWeb Page Designing Using HTML
Web Page Designing Using HTML
 
HTML By K.Sasidhar
HTML By K.SasidharHTML By K.Sasidhar
HTML By K.Sasidhar
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Introduction to css by programmerblog.net
Introduction to css by programmerblog.netIntroduction to css by programmerblog.net
Introduction to css by programmerblog.net
 
Html project
Html projectHtml project
Html project
 
Web Application and HTML Summary
Web Application and HTML SummaryWeb Application and HTML Summary
Web Application and HTML Summary
 
Web development using html 5
Web development using html 5Web development using html 5
Web development using html 5
 
Elements of html powerpoint
Elements of html powerpointElements of html powerpoint
Elements of html powerpoint
 

Similar to Css module1

Similar to Css module1 (20)

Lecture-6.pptx
Lecture-6.pptxLecture-6.pptx
Lecture-6.pptx
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
CSS notes
CSS notesCSS notes
CSS notes
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
IP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).pptIP - Lecture 6, 7 Chapter-3 (3).ppt
IP - Lecture 6, 7 Chapter-3 (3).ppt
 
Turorial css
Turorial cssTurorial css
Turorial css
 
Using Cascading Style Sheets2
Using Cascading Style Sheets2Using Cascading Style Sheets2
Using Cascading Style Sheets2
 
Using Templates And Cascading Style Sheets10
Using Templates And Cascading Style Sheets10Using Templates And Cascading Style Sheets10
Using Templates And Cascading Style Sheets10
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
 
TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0
 
cse labpractical.ppt
cse labpractical.pptcse labpractical.ppt
cse labpractical.ppt
 
Css starting
Css startingCss starting
Css starting
 
Web Designing
Web DesigningWeb Designing
Web Designing
 
CSS (Cascading Style Sheet)
CSS (Cascading Style Sheet)CSS (Cascading Style Sheet)
CSS (Cascading Style Sheet)
 
Css introduction
Css introductionCss introduction
Css introduction
 
Cascading style-sheet-
Cascading style-sheet-Cascading style-sheet-
Cascading style-sheet-
 
Chapter 4a cascade style sheet css
Chapter 4a cascade style sheet cssChapter 4a cascade style sheet css
Chapter 4a cascade style sheet css
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
 
3.2 introduction to css
3.2 introduction to css3.2 introduction to css
3.2 introduction to css
 
HTML to CSS Basics Exer 2.pptx
HTML to CSS Basics Exer 2.pptxHTML to CSS Basics Exer 2.pptx
HTML to CSS Basics Exer 2.pptx
 

More from VARSHAKUMARI49

28,29. procedures subprocedure,type checking functions in VBScript
28,29. procedures  subprocedure,type checking functions in VBScript28,29. procedures  subprocedure,type checking functions in VBScript
28,29. procedures subprocedure,type checking functions in VBScriptVARSHAKUMARI49
 
30,31,32,33. decision and loop statements in vbscript
30,31,32,33. decision and loop statements in vbscript30,31,32,33. decision and loop statements in vbscript
30,31,32,33. decision and loop statements in vbscriptVARSHAKUMARI49
 
27. mathematical, date and time functions in VB Script
27. mathematical, date and time  functions in VB Script27. mathematical, date and time  functions in VB Script
27. mathematical, date and time functions in VB ScriptVARSHAKUMARI49
 
Introduction to web technology
Introduction to web technologyIntroduction to web technology
Introduction to web technologyVARSHAKUMARI49
 
Database normalization
Database normalizationDatabase normalization
Database normalizationVARSHAKUMARI49
 
Register counters.readonly
Register counters.readonlyRegister counters.readonly
Register counters.readonlyVARSHAKUMARI49
 

More from VARSHAKUMARI49 (13)

28,29. procedures subprocedure,type checking functions in VBScript
28,29. procedures  subprocedure,type checking functions in VBScript28,29. procedures  subprocedure,type checking functions in VBScript
28,29. procedures subprocedure,type checking functions in VBScript
 
30,31,32,33. decision and loop statements in vbscript
30,31,32,33. decision and loop statements in vbscript30,31,32,33. decision and loop statements in vbscript
30,31,32,33. decision and loop statements in vbscript
 
27. mathematical, date and time functions in VB Script
27. mathematical, date and time  functions in VB Script27. mathematical, date and time  functions in VB Script
27. mathematical, date and time functions in VB Script
 
Introduction to web technology
Introduction to web technologyIntroduction to web technology
Introduction to web technology
 
Database normalization
Database normalizationDatabase normalization
Database normalization
 
Joins
JoinsJoins
Joins
 
Sub queries
Sub queriesSub queries
Sub queries
 
Introduction to sql
Introduction to sqlIntroduction to sql
Introduction to sql
 
Vbscript
VbscriptVbscript
Vbscript
 
Js mod1
Js mod1Js mod1
Js mod1
 
Register counters.readonly
Register counters.readonlyRegister counters.readonly
Register counters.readonly
 
Sorting.ppt read only
Sorting.ppt read onlySorting.ppt read only
Sorting.ppt read only
 
Hashing
HashingHashing
Hashing
 

Recently uploaded

Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...Call Girls in Nagpur High Profile
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 

Recently uploaded (20)

Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 

Css module1

  • 1. Cascading style sheets (CSS) -Varsha Kumari 9/9/2019 1
  • 2. DHTML • DHTML is the programming language that is embedded in HTML and helps in creation of dynamic web pages using a combination of the static markup language HTML, a client side scripting language (such as JavaScript) and the style definition language Cascading Style Sheets. • HTML specifies a web page’s elements like table, frame, paragraph, list etc. • CSS can be used for formatting some features of those elements like element’s size, color, position etc 9/9/2019 2
  • 3. 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 9/9/2019 3
  • 4. 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 9/9/2019 4
  • 6. 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“; } 6
  • 7. • div { border: 1px solid black; margin: 100px 150px 100px 80px; background-color: lightblue; • } 9/9/2019 7
  • 8. 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 9/9/2019 8
  • 9. 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. 9/9/2019 9
  • 10. 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” 9/9/2019 10
  • 11. 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 9/9/2019 11
  • 12. External Style Sheet Example H1 {color: red;} H6{Color: green;} Save it as “mystyle.css” 9/9/2019 12
  • 13. 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” 9/9/2019 13
  • 14. 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 9/9/2019 14
  • 15. 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) 9/9/2019 15
  • 16. CSS Selectors The element Selector selects elements based on the element name The id Selector uses the id attribute of an HTML tag to find the specific element Hash (#) character, followed by the name of the id The class Selector finds elements with the specific class uses the HTML class attribute Period (.) character, followed by the name of the class 9/9/2019 16
  • 17. Example of Element Selector <html> <head> <style> p {text-align: center; color: red;} </style> </head> <body> <p>Every paragraph will be affected by the style.</p> <p id="para1">Me too!</p> <p>And me!</p> </body> </html> 9/9/2019 17
  • 18. Example of ID Selector <html> <head> <style> #para1 {text-align: center; color: red;} </style> </head> <body> <p id="para1">Hello World!</p> <p>This paragraph is not affected by the style.</p> </body> </html> 9/9/2019 18
  • 19. Another Example of ID Selector <html> <head> <style> p.center { text-align: center; color: red;} </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> </body> </html> 9/9/2019 19
  • 20. Example of CLASS Selector <html> <head> <style> .center { text-align: center; color: red;} </style> </head> <body> <h1 class="center">Red and center-aligned heading</h1> <p class="center">Red and center-aligned paragraph</p> </body> </html> 9/9/2019 20
  • 21. Another Example of CLASS Selector <html> <head> <style> p.uppercase { text-transform: uppercase;} p.lowercase { text-transform: lowercase;} p.capitalize { text-transform: capitalize;} </style> </head> <body> <p class="uppercase">This is some text.</p> <p class="lowercase">This is some text.</p> <p class="capitalize">This is some text.</p> </body> </html>9/9/2019 21
  • 22. Contextual Selectors: • The SPAN element gives structure and context to any inline content in a document. <html><head> <style type = “text/css”> p {background-color: rgb(200,0,255)} p.A {background-color: rgb(250,0,255)} .B{background-color: rgb(0,133,0)} </style></head> <body> <p> welcome to </p> <p class="A">Welcome to <span class = "B"> GLA University</span> Mathura.</p> <p class="B">Uttar Pradesh</p> </body></html>9/9/2019 22
  • 23. Document Object Model(DOM): • The components of web pages are represented by objects that are organized in hierarchical structure(parent-child relationship), called DOM • These objects have properties and methods that can be used to work with web pages. • For a script to communicate one of the objects it must know the path through the hierarchy to reach the object, so it can call one of the methods or set one of its property values. • Ex • document.form1.firstname.value • Document.bgcolor=“lightgreen” • Document.title=“new title is my second web page” • Document.write(“<h1>hello</h1>”); 9/9/2019 23
  • 25. Browser Object Model • The browser object model (BOM) is a hierarchy of browser objects that are used to manipulate methods and properties associated with the Web browser itself. • BOM include the window object, navigator object, screen object, history, location object, and the document object. • Top of the object hierarchy is the windows object. • The Document Object consists of objects that are used to manipulate methods and properties of the document or Web page loaded in the browser window. 9/9/2019 25