SlideShare a Scribd company logo
Introduction to CSS
What is CSS
• Cascading Style Sheets
• Contains the rules for the presentation of
HTML.
+ =
HTML CSS Web Page
• CSS was introduced to keep the
presentation information separate from
HTML markup (content).
Before CSS
• Initially Designers used presentation tags like (FONT, B, BR, TABLE
etc.) and spacers GIFs to control the design of web pages.
• Any modification in the design of websites
was a very difficult and boring task , as it
evolves manually editing every HTML
page.
Providing support for multiple browsers was a
difficult task.
• Advantages of CSS
• CSS saves time
When most of us first learn HTML, we get taught to set the font face, size,
colour, style etc every time it occurs on a page. This means we find
ourselves typing (or copying & pasting) the same thing over and over again.
With CSS, you only have to specify these details once for any element. CSS
will automatically apply the specified styles whenever that element occurs.
• Pages load faster
Less code means faster download times.
• Easy maintenance
To change the style of an element, you only have to make an edit in one
place.
• Superior styles to HTML
CSS has a much wider array of attributes than HTML.
• Disadvantages of CSS
• Browser compatibility
Browsers have varying levels of compliance with Style Sheets. This means
that some Style Sheet features are supported and some aren't. To confuse
things more, some browser manufacturers decide to come up with their own
proprietary tags.
7
How to write CSS?
• Selector
– HTML element tags
(examples: p, h2, body, img, table)
– class and ID names
• Property (examples: color, font-size)
• Value (examples: red, 14pt)
8
How to write CSS:
• The basic syntax of a CSS rule:
selector {property 1: value 1; property 2:
value 2}
Example:
p {font-size: 8pt; color: red}
Notice the { } around the rule and the : before
each value!
Sources of Styles
Author (developer) Styles
• Inline Styles - As inline attribute “style” inside HTML tags
<div style=“font-weight: bold;”>I am bold</div>
• Embedded Styles - As embedded style tag with in HTML
document.
<html>
<head>
<title>Welcome to Vendio!</title>
<style>
.footer {
width:90%;
}
</style>
-------
</html>
• Linked Styles - Inside separate files with .css extension
<link rel="stylesheet" href=“external.css" type="text/css" />
Sources of Styles(contd.)
• User Style sheets
This file contains the user created styles .
[firefox profile folder]/ chrome/userContent-example.css
is the current user’s style sheet file for the firefox.
• Browser default style sheet
This file contains default styles for all users of a
browser
[firefox folder]/res/html.css is the default style sheet
file for the firefox.
CSS Selectors
• ID based ( #)
HTML CSS
<div id=“content”> #content {
Text width: 200px;
</div> }
ID selectors should be used with single elements.
Class based selector
• Class (.)
HTML CSS
<div class=“big”> .big{
Text width: 200px;
</div> }
<div>
<span class=“big”>some text </span>
</div>
Class based styles can be used by multiple HTML elements.
Tag based selectors
• Tag (Tag name)
HTML CSS
<div> DIV {
Text width: 200px;
</div> }
<div> SPAN {
<span>some text </span> font-size:130%;
</div> }
<span>some other text </span>
Grouping
• Multiple selectors can be grouped in a
single style declaration by using , .
H1, P , .main {
font-weight:bold;
}
CSS Values
• Words: text-align:center;.
• Numerical values: Numerical values are usually
followed by a unit type.
font-size:12px;
12 is the numerical value and px is the unit type pixels.
– Absolute Values – in, pc, px, cm, mm, pt
– Relative Values – em, ex, %
• Color values: color:#336699 or color#369 or
rgb(255, 255, 255).
Categories of CSS properties
• Positioning and layout handling related.
• Background related properties.
• Font and text related
• Links related.
• Lists related.
• Table related.
Cascade
The CSS cascade assigns a weight
to each style rule. When several
rules apply, the one with the
greatest weight takes precedence.
Order of preference for various
styles:
– Default browser style sheet
(weakest)
– User style sheet
– Author style sheet
– Author embedded styles
– Author inline styles (strongest)
CSS Specificity
Rule 1. CSS File >> Embedded >> Inline
Rule 2. TAG >> class >> ID
CSS Units & Colors
• Units
– %
– in
– cm
– mm
– em (12pt)
– px
– pt
• Colors
– color name (red, etc)
– rgb(x,x,x)
– #rrggbb (HEX)
Inheritance
• Styles that relate to text and appearance
are inherited by the descendant
elements.
• Styles that relate to the appearance of
boxes created by styling DIVs,
paragraphs, and other elements, such as
borders, padding, margins are not
inherited.
The Box Model
• Every element in the DOM (Document Object Model) has a
conceptual “box” for presentation.
• The box consists of margin, padding, border, content
(width, height), and offset (top, left)
22
Properties - Font
• font-family
– Name, or serif, sans-serif, cursive, monospace
• font-style
– normal, italic
• font-weight
– normal, bold, 100, 200, 300, 400, 500, 600, 700, 800,
900
• font-size
– absolute-size, relative-size, length, percentage
• font-variant
– small-caps
23
Properties - Text
• text-decoration
– underline, line-through
• text-transform
– capitalize, uppercase, lowercase, none
• text-align
– left, right, center, justify
• text-indent
– <length>, <percentage>
24
Properties - Position
• position
– absolute, relative
• top
– <length>, <percentage>, auto
• left
– <length>, <percentage>, auto
• Z-index
– <number>, auto
CSS Layout
• Margin
• Padding
• Border
• Z-index
• Positioning
• Width
• Height
• Float
• Text-align
• Vertical-align
26
Backgrounds
• background-color
– Hex
• background-image
– URL(image.jpg)
• background-repeat
– No-repeat, repeat-x, repeat-y
• background-attachment
– Fixed, scroll
• background-position
– Top, left
• p { background-position: 70px 10px; background-repeat: repeat-y;
background-image: url(background.gif) }
Example
27
Background repeat examples:
CSS Lists
• List-style
• List-style-image
• List-style-position
• List-style-type
29
CSS Link
• a:link {color: #FFFFFF; text-decoration: none}
• a:visited {color: #808080; text-decoration: none}
• a:hover {color: red; text-decoration: none}
• a:active {color: blue; text-decoration: none}
CSS Shorthand
• Consolidates many styles into a single declaration.
font-family: verdana, sans-serif;
font-weight: bold;
font-size: 12px;
 font: bold 12px verdana, sans-serif;
padding-top: 5px;
padding-right: 8px;
padding-bottom: 5px;
padding-left: 10px;
 padding: 5px 8px 5px 10px;
31
Border values
Descendant selectors
Descendant selectors are used to select elements that
are descendants (not necessarily children) of another
element in the document tree.
HTML CSS
<div class=“abc”> DIV.abc P {
<div> font-weight:bold;
<P> }
Hello there!
</p>
</div>
</div>
Child selectors
A child selector is used to select an element that is a
direct child of another element (parent). Child selectors
will not select all descendants, only direct children.
HTML CSS
<div > DIV.abc > P {
<div class=“abc”> font-weight:bold;
<P> }
Hello there!
</p>
</div>
</div>
Universal selectors
Universal selectors are used to select any
element.
* {
color: blue;
}
Adjacent sibling selectors
Adjacent sibling selectors will select the
sibling immediately following an element.
DIV.abc + P {
font-weight: bold;
}
will work for
<div>
<div class=“abc”>Message</div>
<P>Hello there!</p>
</div>
Attribute selectors
Attribute selectors selects elements based
upon the attributes present in the HTML
Tags and their value.
IMG[src="small.gif"] {
border: 1px solid #000;
}
will work for
<img src=“small.gif” />
CSS Pseudo-classes
selector:pseudo-elements/class { property: value
}
:link
:visited Link (A tag) related pseudo classes
:hover
:active
:first-child
::after
::before
::first-letter
::first-line
::selection
Pseudo Elements
Selector Example Example description
::after p::after Insert something after the content of each <p> element
::before p::before Insert something before the content of each <p> element
::first-letter p::first-letter Selects the first letter of each <p> element
::first-line p::first-line Selects the first line of each <p> element
::selection p::selection Selects the portion of an element that is selected by a
user
2 introduction css
2 introduction css
Refrences
• www.w3schools.com
• www.w3.org
• World wide web
Ad

More Related Content

What's hot (20)

Css
CssCss
Css
mohamed ashraf
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
Amit Tyagi
 
1 03 - CSS Introduction
1 03 - CSS Introduction1 03 - CSS Introduction
1 03 - CSS Introduction
apnwebdev
 
Css3
Css3Css3
Css3
Deepak Mangal
 
Css
CssCss
Css
Abhishek Kesharwani
 
CSS
CSSCSS
CSS
Raja Kumar Ranjan
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
Evolution Network
 
CSS introduction
CSS introductionCSS introduction
CSS introduction
CloudTech 
 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
Singsys Pte Ltd
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smithaps4
 
Intro to css & sass
Intro to css & sassIntro to css & sass
Intro to css & sass
Sean Wolfe
 
Html css
Html cssHtml css
Html css
mohamed ashraf
 
Week11 Lecture: CSS
Week11 Lecture: CSSWeek11 Lecture: CSS
Week11 Lecture: CSS
Katherine McCurdy-Lapierre, R.G.D.
 
Responsive web design with html5 and css3
Responsive web design with html5 and css3Responsive web design with html5 and css3
Responsive web design with html5 and css3
Divya Tiwari
 
Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
Chris Poteet
 
Html
HtmlHtml
Html
Kamal Acharya
 
Css
CssCss
Css
Yudha Arif Budiman
 
Basic css
Basic cssBasic css
Basic css
Gopinath Ambothi
 
CSS
CSS CSS
CSS
Sunil OS
 
Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)
AakankshaR
 

Similar to 2 introduction css (20)

introductiontohtmlcss-part2-120711042239-phpapp02.ppt
introductiontohtmlcss-part2-120711042239-phpapp02.pptintroductiontohtmlcss-part2-120711042239-phpapp02.ppt
introductiontohtmlcss-part2-120711042239-phpapp02.ppt
SherwinSangalang3
 
introduction to css cascading style sheets
introduction to css cascading style sheetsintroduction to css cascading style sheets
introduction to css cascading style sheets
SherwinSangalang3
 
CSS Overview
CSS OverviewCSS Overview
CSS Overview
Doncho Minkov
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
Salman Memon
 
lec11_CSS.pptx web page description desi
lec11_CSS.pptx web page description desilec11_CSS.pptx web page description desi
lec11_CSS.pptx web page description desi
compengwaelalahmar
 
Web Engineering - Introduction to CSS
Web Engineering - Introduction to CSSWeb Engineering - Introduction to CSS
Web Engineering - Introduction to CSS
Nosheen Qamar
 
howcssworks-100207024009-phpapp01.pptx
howcssworks-100207024009-phpapp01.pptxhowcssworks-100207024009-phpapp01.pptx
howcssworks-100207024009-phpapp01.pptx
RavneetSingh343801
 
uptu web technology unit 2 Css
uptu web technology unit 2 Cssuptu web technology unit 2 Css
uptu web technology unit 2 Css
Abhishek Kesharwani
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smitha273566
 
basic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdfbasic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdf
elayelily
 
cascadingstylesheets,introduction.css styles-210909054722.pptx
cascadingstylesheets,introduction.css styles-210909054722.pptxcascadingstylesheets,introduction.css styles-210909054722.pptx
cascadingstylesheets,introduction.css styles-210909054722.pptx
hannahroseline2
 
Web application is an application that is accessed by web visitor over intern...
Web application is an application that is accessed by web visitor over intern...Web application is an application that is accessed by web visitor over intern...
Web application is an application that is accessed by web visitor over intern...
MdAmreen
 
Unit-3-CSS-BWT.pptx
Unit-3-CSS-BWT.pptxUnit-3-CSS-BWT.pptx
Unit-3-CSS-BWT.pptx
Tanu524249
 
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSS
Sun Technlogies
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
KushagraChadha1
 
Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...
JebaRaj26
 
Web design-workflow
Web design-workflowWeb design-workflow
Web design-workflow
Peter Kaizer
 
Css ms megha
Css ms meghaCss ms megha
Css ms megha
Megha Gupta
 
ch04-css-basics_final.ppt
ch04-css-basics_final.pptch04-css-basics_final.ppt
ch04-css-basics_final.ppt
GmachImen
 
Introduction to Wed System And Technologies (1).pptx
Introduction to Wed System And Technologies (1).pptxIntroduction to Wed System And Technologies (1).pptx
Introduction to Wed System And Technologies (1).pptx
AmeerHamza183012
 
introductiontohtmlcss-part2-120711042239-phpapp02.ppt
introductiontohtmlcss-part2-120711042239-phpapp02.pptintroductiontohtmlcss-part2-120711042239-phpapp02.ppt
introductiontohtmlcss-part2-120711042239-phpapp02.ppt
SherwinSangalang3
 
introduction to css cascading style sheets
introduction to css cascading style sheetsintroduction to css cascading style sheets
introduction to css cascading style sheets
SherwinSangalang3
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
Salman Memon
 
lec11_CSS.pptx web page description desi
lec11_CSS.pptx web page description desilec11_CSS.pptx web page description desi
lec11_CSS.pptx web page description desi
compengwaelalahmar
 
Web Engineering - Introduction to CSS
Web Engineering - Introduction to CSSWeb Engineering - Introduction to CSS
Web Engineering - Introduction to CSS
Nosheen Qamar
 
howcssworks-100207024009-phpapp01.pptx
howcssworks-100207024009-phpapp01.pptxhowcssworks-100207024009-phpapp01.pptx
howcssworks-100207024009-phpapp01.pptx
RavneetSingh343801
 
Cascading style sheets
Cascading style sheetsCascading style sheets
Cascading style sheets
smitha273566
 
basic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdfbasic programming language AND HTML CSS JAVApdf
basic programming language AND HTML CSS JAVApdf
elayelily
 
cascadingstylesheets,introduction.css styles-210909054722.pptx
cascadingstylesheets,introduction.css styles-210909054722.pptxcascadingstylesheets,introduction.css styles-210909054722.pptx
cascadingstylesheets,introduction.css styles-210909054722.pptx
hannahroseline2
 
Web application is an application that is accessed by web visitor over intern...
Web application is an application that is accessed by web visitor over intern...Web application is an application that is accessed by web visitor over intern...
Web application is an application that is accessed by web visitor over intern...
MdAmreen
 
Unit-3-CSS-BWT.pptx
Unit-3-CSS-BWT.pptxUnit-3-CSS-BWT.pptx
Unit-3-CSS-BWT.pptx
Tanu524249
 
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSS
Sun Technlogies
 
Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...Cascading Styling Sheets(CSS) simple design language intended to transform th...
Cascading Styling Sheets(CSS) simple design language intended to transform th...
JebaRaj26
 
Web design-workflow
Web design-workflowWeb design-workflow
Web design-workflow
Peter Kaizer
 
ch04-css-basics_final.ppt
ch04-css-basics_final.pptch04-css-basics_final.ppt
ch04-css-basics_final.ppt
GmachImen
 
Introduction to Wed System And Technologies (1).pptx
Introduction to Wed System And Technologies (1).pptxIntroduction to Wed System And Technologies (1).pptx
Introduction to Wed System And Technologies (1).pptx
AmeerHamza183012
 
Ad

More from Jalpesh Vasa (16)

Object Oriented PHP - PART-1
Object Oriented PHP - PART-1Object Oriented PHP - PART-1
Object Oriented PHP - PART-1
Jalpesh Vasa
 
Object Oriented PHP - PART-2
Object Oriented PHP - PART-2Object Oriented PHP - PART-2
Object Oriented PHP - PART-2
Jalpesh Vasa
 
5. HTML5
5. HTML55. HTML5
5. HTML5
Jalpesh Vasa
 
4.4 PHP Session
4.4 PHP Session4.4 PHP Session
4.4 PHP Session
Jalpesh Vasa
 
4.3 MySQL + PHP
4.3 MySQL + PHP4.3 MySQL + PHP
4.3 MySQL + PHP
Jalpesh Vasa
 
4.2 PHP Function
4.2 PHP Function4.2 PHP Function
4.2 PHP Function
Jalpesh Vasa
 
4.1 PHP Arrays
4.1 PHP Arrays4.1 PHP Arrays
4.1 PHP Arrays
Jalpesh Vasa
 
4 Basic PHP
4 Basic PHP4 Basic PHP
4 Basic PHP
Jalpesh Vasa
 
3.2.1 javascript regex example
3.2.1 javascript regex example3.2.1 javascript regex example
3.2.1 javascript regex example
Jalpesh Vasa
 
3.2 javascript regex
3.2 javascript regex3.2 javascript regex
3.2 javascript regex
Jalpesh Vasa
 
3. Java Script
3. Java Script3. Java Script
3. Java Script
Jalpesh Vasa
 
3.1 javascript objects_DOM
3.1 javascript objects_DOM3.1 javascript objects_DOM
3.1 javascript objects_DOM
Jalpesh Vasa
 
1 web technologies
1 web technologies1 web technologies
1 web technologies
Jalpesh Vasa
 
Remote Method Invocation in JAVA
Remote Method Invocation in JAVARemote Method Invocation in JAVA
Remote Method Invocation in JAVA
Jalpesh Vasa
 
Kotlin for android development
Kotlin for android developmentKotlin for android development
Kotlin for android development
Jalpesh Vasa
 
Security in php
Security in phpSecurity in php
Security in php
Jalpesh Vasa
 
Object Oriented PHP - PART-1
Object Oriented PHP - PART-1Object Oriented PHP - PART-1
Object Oriented PHP - PART-1
Jalpesh Vasa
 
Object Oriented PHP - PART-2
Object Oriented PHP - PART-2Object Oriented PHP - PART-2
Object Oriented PHP - PART-2
Jalpesh Vasa
 
3.2.1 javascript regex example
3.2.1 javascript regex example3.2.1 javascript regex example
3.2.1 javascript regex example
Jalpesh Vasa
 
3.2 javascript regex
3.2 javascript regex3.2 javascript regex
3.2 javascript regex
Jalpesh Vasa
 
3.1 javascript objects_DOM
3.1 javascript objects_DOM3.1 javascript objects_DOM
3.1 javascript objects_DOM
Jalpesh Vasa
 
1 web technologies
1 web technologies1 web technologies
1 web technologies
Jalpesh Vasa
 
Remote Method Invocation in JAVA
Remote Method Invocation in JAVARemote Method Invocation in JAVA
Remote Method Invocation in JAVA
Jalpesh Vasa
 
Kotlin for android development
Kotlin for android developmentKotlin for android development
Kotlin for android development
Jalpesh Vasa
 
Ad

Recently uploaded (20)

E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)
jemille6
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living WorkshopLDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDM Mia eStudios
 
The History of Kashmir Karkota Dynasty NEP.pptx
The History of Kashmir Karkota Dynasty NEP.pptxThe History of Kashmir Karkota Dynasty NEP.pptx
The History of Kashmir Karkota Dynasty NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon DolabaniHistory Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
fruinkamel7m
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFAMEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
Dr. Nasir Mustafa
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
puzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tensepuzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tense
OlgaLeonorTorresSnch
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Final Evaluation.docx...........................
Final Evaluation.docx...........................Final Evaluation.docx...........................
Final Evaluation.docx...........................
l1bbyburrell
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
*"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"**"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"*
Arshad Shaikh
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)
jemille6
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living WorkshopLDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDM Mia eStudios
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon DolabaniHistory Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
fruinkamel7m
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFAMEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
Dr. Nasir Mustafa
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
puzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tensepuzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tense
OlgaLeonorTorresSnch
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Final Evaluation.docx...........................
Final Evaluation.docx...........................Final Evaluation.docx...........................
Final Evaluation.docx...........................
l1bbyburrell
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
*"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"**"Sensing the World: Insect Sensory Systems"*
*"Sensing the World: Insect Sensory Systems"*
Arshad Shaikh
 

2 introduction css

  • 2. What is CSS • Cascading Style Sheets • Contains the rules for the presentation of HTML. + = HTML CSS Web Page • CSS was introduced to keep the presentation information separate from HTML markup (content).
  • 3. Before CSS • Initially Designers used presentation tags like (FONT, B, BR, TABLE etc.) and spacers GIFs to control the design of web pages.
  • 4. • Any modification in the design of websites was a very difficult and boring task , as it evolves manually editing every HTML page.
  • 5. Providing support for multiple browsers was a difficult task.
  • 6. • Advantages of CSS • CSS saves time When most of us first learn HTML, we get taught to set the font face, size, colour, style etc every time it occurs on a page. This means we find ourselves typing (or copying & pasting) the same thing over and over again. With CSS, you only have to specify these details once for any element. CSS will automatically apply the specified styles whenever that element occurs. • Pages load faster Less code means faster download times. • Easy maintenance To change the style of an element, you only have to make an edit in one place. • Superior styles to HTML CSS has a much wider array of attributes than HTML. • Disadvantages of CSS • Browser compatibility Browsers have varying levels of compliance with Style Sheets. This means that some Style Sheet features are supported and some aren't. To confuse things more, some browser manufacturers decide to come up with their own proprietary tags.
  • 7. 7 How to write CSS? • Selector – HTML element tags (examples: p, h2, body, img, table) – class and ID names • Property (examples: color, font-size) • Value (examples: red, 14pt)
  • 8. 8 How to write CSS: • The basic syntax of a CSS rule: selector {property 1: value 1; property 2: value 2} Example: p {font-size: 8pt; color: red} Notice the { } around the rule and the : before each value!
  • 9. Sources of Styles Author (developer) Styles • Inline Styles - As inline attribute “style” inside HTML tags <div style=“font-weight: bold;”>I am bold</div> • Embedded Styles - As embedded style tag with in HTML document. <html> <head> <title>Welcome to Vendio!</title> <style> .footer { width:90%; } </style> ------- </html> • Linked Styles - Inside separate files with .css extension <link rel="stylesheet" href=“external.css" type="text/css" />
  • 10. Sources of Styles(contd.) • User Style sheets This file contains the user created styles . [firefox profile folder]/ chrome/userContent-example.css is the current user’s style sheet file for the firefox. • Browser default style sheet This file contains default styles for all users of a browser [firefox folder]/res/html.css is the default style sheet file for the firefox.
  • 11. CSS Selectors • ID based ( #) HTML CSS <div id=“content”> #content { Text width: 200px; </div> } ID selectors should be used with single elements.
  • 12. Class based selector • Class (.) HTML CSS <div class=“big”> .big{ Text width: 200px; </div> } <div> <span class=“big”>some text </span> </div> Class based styles can be used by multiple HTML elements.
  • 13. Tag based selectors • Tag (Tag name) HTML CSS <div> DIV { Text width: 200px; </div> } <div> SPAN { <span>some text </span> font-size:130%; </div> } <span>some other text </span>
  • 14. Grouping • Multiple selectors can be grouped in a single style declaration by using , . H1, P , .main { font-weight:bold; }
  • 15. CSS Values • Words: text-align:center;. • Numerical values: Numerical values are usually followed by a unit type. font-size:12px; 12 is the numerical value and px is the unit type pixels. – Absolute Values – in, pc, px, cm, mm, pt – Relative Values – em, ex, % • Color values: color:#336699 or color#369 or rgb(255, 255, 255).
  • 16. Categories of CSS properties • Positioning and layout handling related. • Background related properties. • Font and text related • Links related. • Lists related. • Table related.
  • 17. Cascade The CSS cascade assigns a weight to each style rule. When several rules apply, the one with the greatest weight takes precedence. Order of preference for various styles: – Default browser style sheet (weakest) – User style sheet – Author style sheet – Author embedded styles – Author inline styles (strongest)
  • 18. CSS Specificity Rule 1. CSS File >> Embedded >> Inline Rule 2. TAG >> class >> ID
  • 19. CSS Units & Colors • Units – % – in – cm – mm – em (12pt) – px – pt • Colors – color name (red, etc) – rgb(x,x,x) – #rrggbb (HEX)
  • 20. Inheritance • Styles that relate to text and appearance are inherited by the descendant elements. • Styles that relate to the appearance of boxes created by styling DIVs, paragraphs, and other elements, such as borders, padding, margins are not inherited.
  • 21. The Box Model • Every element in the DOM (Document Object Model) has a conceptual “box” for presentation. • The box consists of margin, padding, border, content (width, height), and offset (top, left)
  • 22. 22 Properties - Font • font-family – Name, or serif, sans-serif, cursive, monospace • font-style – normal, italic • font-weight – normal, bold, 100, 200, 300, 400, 500, 600, 700, 800, 900 • font-size – absolute-size, relative-size, length, percentage • font-variant – small-caps
  • 23. 23 Properties - Text • text-decoration – underline, line-through • text-transform – capitalize, uppercase, lowercase, none • text-align – left, right, center, justify • text-indent – <length>, <percentage>
  • 24. 24 Properties - Position • position – absolute, relative • top – <length>, <percentage>, auto • left – <length>, <percentage>, auto • Z-index – <number>, auto
  • 25. CSS Layout • Margin • Padding • Border • Z-index • Positioning • Width • Height • Float • Text-align • Vertical-align
  • 26. 26 Backgrounds • background-color – Hex • background-image – URL(image.jpg) • background-repeat – No-repeat, repeat-x, repeat-y • background-attachment – Fixed, scroll • background-position – Top, left • p { background-position: 70px 10px; background-repeat: repeat-y; background-image: url(background.gif) } Example
  • 28. CSS Lists • List-style • List-style-image • List-style-position • List-style-type
  • 29. 29 CSS Link • a:link {color: #FFFFFF; text-decoration: none} • a:visited {color: #808080; text-decoration: none} • a:hover {color: red; text-decoration: none} • a:active {color: blue; text-decoration: none}
  • 30. CSS Shorthand • Consolidates many styles into a single declaration. font-family: verdana, sans-serif; font-weight: bold; font-size: 12px;  font: bold 12px verdana, sans-serif; padding-top: 5px; padding-right: 8px; padding-bottom: 5px; padding-left: 10px;  padding: 5px 8px 5px 10px;
  • 32. Descendant selectors Descendant selectors are used to select elements that are descendants (not necessarily children) of another element in the document tree. HTML CSS <div class=“abc”> DIV.abc P { <div> font-weight:bold; <P> } Hello there! </p> </div> </div>
  • 33. Child selectors A child selector is used to select an element that is a direct child of another element (parent). Child selectors will not select all descendants, only direct children. HTML CSS <div > DIV.abc > P { <div class=“abc”> font-weight:bold; <P> } Hello there! </p> </div> </div>
  • 34. Universal selectors Universal selectors are used to select any element. * { color: blue; }
  • 35. Adjacent sibling selectors Adjacent sibling selectors will select the sibling immediately following an element. DIV.abc + P { font-weight: bold; } will work for <div> <div class=“abc”>Message</div> <P>Hello there!</p> </div>
  • 36. Attribute selectors Attribute selectors selects elements based upon the attributes present in the HTML Tags and their value. IMG[src="small.gif"] { border: 1px solid #000; } will work for <img src=“small.gif” />
  • 37. CSS Pseudo-classes selector:pseudo-elements/class { property: value } :link :visited Link (A tag) related pseudo classes :hover :active :first-child ::after ::before ::first-letter ::first-line ::selection
  • 38. Pseudo Elements Selector Example Example description ::after p::after Insert something after the content of each <p> element ::before p::before Insert something before the content of each <p> element ::first-letter p::first-letter Selects the first letter of each <p> element ::first-line p::first-line Selects the first line of each <p> element ::selection p::selection Selects the portion of an element that is selected by a user
  翻译: