SlideShare ist ein Scribd-Unternehmen logo
1 von 43
What we will talk about:
•HTML and CSS
•CSS Selectors
•CSS Properties
•Cascade
•Media Queries
•Animations
Client-side coding includes HTML, CSS and
Javascript. This just means that the code rendered
in the browser.
STRUCTURE
HTML markup
PRESENTATION
CSS
BEHAVIOR
Javascript
HTML Document Hierarchy: Parents, children and
siblings
HTML elements are described in terms of relationships.
All elements in the document have a parent (up to ‘document’,
which is at the top), and may have children (nested inside) or
siblings (placed alongside).
<parent x>
<child and sibling y> </child and sibling y>
<child and sibling z> </child and sibling z>
</parent x>
Cascading
+
Style Sheets
•A style sheet isaset of rulesdefining how
an html element will be“presented” in
the browser
•Theserules are targeted to specific
elements in the html
document(DOM)
Style Sheet
Style sheet linking types
• 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" />
• User Style sheets
Contains the user created styles
• Browser default style sheet
Contains default styles for all users of a browser
CSSSyntax
Syntax = the rules for how to write the language
Three terms for
describing yourstyles:
CSSrule
CSS selector
CSS declaration
CSSRule
selector {property: value;}
Every style is defined by a selector and
a declaration. The declaration contains at least
one property/value pair.Together they are
called a CSS Rule.
declaration
CSSDeclaration
You can apply multiple declarations to a
selector(s) by separating the delcarations with
semi-colons.
sans-serif;
p {
font-family: Arial,
font-size: 14px;
color: #666666;
}
CSSSelectors
p Type (element)
# ID
. Class
[] Attribute
* Universal
Type (element)Selectors
body {declaration}
p {declaration}
h1 {declaration}
ul {declaration}
The simplest selector is the type selector,which
targets an html element by name.
The essential selector types(elements)
Primary
Structur
e
Body
Element
s
Formatting
Elements
html p em
body br i
h1 – h6 strong
ul b
ol q
a blockquote
img
div
span
IDSelectors
CSS
#logo {declaration}
HTML
<img id=”logo” src=”” alt=””>
An ID is an html attribute that is added to your
html markup. You reference that ID in your css
with a hash.
ClassSelectors
CSS
.ingredients {declaration}
HTML
<ul class=”ingredients”>
A class is an html attribute that is added toyour
html markup. You reference that ID in your css
with a period.
Attribute selectors
Attribute selectors selects elements based upon the attributes present
in the HTMLTags and their value.
IMG[src="small.gif"] {
border: 1px solid #000;
}
will work for
<img src=“small.gif” />
CSS Pseudo-classes
selector:pseudo-class { property: value }
:link
:visited } Link (A tag) related pseudo classes
:hover
:active
:after
:before
:first-child
:focus
:first-letter
:first-line
:lang
CSS Pseudo-element
selector::pseudo-element
{
property: value
}
::after
::before
::first-letter
::first-line
::selection
Universal selectors
Universal selectors are used to select any element.
* {
color: blue;
}
Grouping
• Multiple selectors can be grouped in a single style declaration by using , .
H1, P , .main {
font-weight:bold;
}
Combinators
• Descendant combinatory
• Child > combinatory
• General ~ sibling
• Adjacent + sibling
Categories of CSS Properties
• Positioning and layout handling related.
• Background related properties.
• Font and text related
• Links related.
• Lists related.
• Table related.
CSSValues
• 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.
• AbsoluteValues – in, pc, px, cm, mm, pt
• RelativeValues – em, ex, %
• Color values: color:#336699 or color#369.
Color properties
• Color
• Named color
• Hex(#)
• rgb()/rgba()
• hsl()/hsla()
• Opacity
Basic text properties
• Text-decoration: overline | underline | line - through
• Text-transform: none | lowercase | uppercase | capitalize
• Text-shadow (2px, 2px, grey)
Basic font properties
• font-style: normal| italic | oblique
• Font-weight: normal | bold | bolder | light | lighter | #
• Font-size: {length}
• font-family: {font}
Box Model
Sizing
• width
• height
• min/max prefixes
• box-sizing : content-box | border-box
Visibility
• display: inline| block | inline-block
• visibility : visible | hidden
• white-space : normal | pre | nowrap | …
• overflow : visible | hidden | scroll | auto
Cascade
• It ultimately determines which css
properties will apply to a given element
• cascade is tied to three main concepts
– Importance
– Specificity
– Inheritance
Importance
• Style sheets can have a few different sources
User agent(browser styles), User(user’s browser options), Author(inline, embedded or
external)
• “!important” declaration – balance the priority of user and author style
• Ascending order of importance
User agent declarations
User declarations
Author declarations
Author !important declarations
User !important declarations
Specificity
• Specificity refers to how specific your selector isin naming anelement
• Every CSS rule has a particular weight
• This weight defines which properties will be applied to an element when
there are conflicting rules.
• If one rule is more specific than another, it overrides others.
• Two rules share the same weight, source and specificity, the later one is
applied.
Inheritance
• Inheritance is a way of propagating property values from parent elements to
their children
• When an element inherits a value from its parent, it is inheriting its
computed value
• Not all properties are inherited(e.g – padding, margin, border..etc), but
you can force ones to be by using the ”inherit” value(e.g p {border: inherit})
• No specificity(lowest priority)
• Made it possible to define different style rules for different media
types.(computer screens, printers, handheld devices..etc)
• Syntax
@media mediatype and (expressions) {
CSS-Code;
}
• Result of the query is true if the specified media type matches the type of
device the document is being displayed on and all expressions in the media
query are true.
When a media query is true, the corresponding style sheet or style rules are
applied, following the normal cascading rules.
Media Queries
• CSS animations allows animation of most HTML elements without using JavaScript
or Flash!
• @keyframes name{
from CSS-Code; to CSS-Code ;
}
When you specify CSS styles inside the keyframes the animation will gradually
change from the current style to the new style at certain times.
• To get an animation to work, you must bind the animation to an element.
• selector {
animation-name: name; animation-duration: time;
}
• http://www.hongkiat.com/blog/creative-css-animations/
Animation
Some things you can change with CSS
colors
type
type size
backgrounds
spacing
sizes
borders
positions (layout)
Some things you can’t change with CSS
content
markup
Exercise
• Design a responsive online shopping cart by using html and css (no
JavaScript).
• http://www.w3schools.com/css/default.asp
• https://www.smashingmagazine.com/2010/04/css-specificity-and-
inheritance/
• http://carl.camera/?id=95
• https://www.smashingmagazine.com/2010/04/css-specificity-and-
inheritance/
References

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

CSS
CSSCSS
CSS
 
CSS Best practice
CSS Best practiceCSS Best practice
CSS Best practice
 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive Design
 
CSS For Backend Developers
CSS For Backend DevelopersCSS For Backend Developers
CSS For Backend Developers
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
 
HTML Introduction, HTML History, HTML Uses, HTML benifits
HTML Introduction, HTML History, HTML Uses, HTML benifitsHTML Introduction, HTML History, HTML Uses, HTML benifits
HTML Introduction, HTML History, HTML Uses, HTML benifits
 
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
CSS
CSSCSS
CSS
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
Css Ppt
Css PptCss Ppt
Css Ppt
 
CSS
CSSCSS
CSS
 
CSS for Beginners
CSS for BeginnersCSS for Beginners
CSS for Beginners
 
HTML and CSS crash course!
HTML and CSS crash course!HTML and CSS crash course!
HTML and CSS crash course!
 
CSS
CSSCSS
CSS
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3
 
CSS Introduction
CSS IntroductionCSS Introduction
CSS Introduction
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 
Html basics
Html basicsHtml basics
Html basics
 

Andere mochten auch

Andere mochten auch (20)

Chapter 12
Chapter 12Chapter 12
Chapter 12
 
CSS3 notes
CSS3 notesCSS3 notes
CSS3 notes
 
Chapter 25
Chapter 25Chapter 25
Chapter 25
 
Intro To ECAT
Intro To ECATIntro To ECAT
Intro To ECAT
 
Chapter 19
Chapter 19Chapter 19
Chapter 19
 
HTML5 &CSS: Chapter 08
HTML5 &CSS: Chapter 08HTML5 &CSS: Chapter 08
HTML5 &CSS: Chapter 08
 
HTML & CSS: Chapter 07
HTML & CSS: Chapter 07HTML & CSS: Chapter 07
HTML & CSS: Chapter 07
 
HTML & CSS: Chapter 03
HTML & CSS: Chapter 03HTML & CSS: Chapter 03
HTML & CSS: Chapter 03
 
HTML: Chapter 01
HTML: Chapter 01HTML: Chapter 01
HTML: Chapter 01
 
Html and CSS: Chapter 02
Html and CSS: Chapter 02Html and CSS: Chapter 02
Html and CSS: Chapter 02
 
HTML & CSS: Chapter 06
HTML & CSS: Chapter 06HTML & CSS: Chapter 06
HTML & CSS: Chapter 06
 
CSS - Basics
CSS - BasicsCSS - Basics
CSS - Basics
 
Unit 6, Lesson 3 - Vectors
Unit 6, Lesson 3 - VectorsUnit 6, Lesson 3 - Vectors
Unit 6, Lesson 3 - Vectors
 
HTML & CSS: Chapter 04
HTML & CSS: Chapter 04HTML & CSS: Chapter 04
HTML & CSS: Chapter 04
 
Bread board
Bread boardBread board
Bread board
 
Breadboard
BreadboardBreadboard
Breadboard
 
Basic css
Basic cssBasic css
Basic css
 
Web Engineering - Basic CSS Properties
Web Engineering - Basic CSS PropertiesWeb Engineering - Basic CSS Properties
Web Engineering - Basic CSS Properties
 
Vernier caliper
Vernier caliperVernier caliper
Vernier caliper
 
Spline Interpolation
Spline InterpolationSpline Interpolation
Spline Interpolation
 

Ähnlich wie CSS

CSS Foundations, pt 2
CSS Foundations, pt 2CSS Foundations, pt 2
CSS Foundations, pt 2
Shawn Calvert
 
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
 

Ähnlich wie CSS (20)

CSS Overview
CSS OverviewCSS Overview
CSS Overview
 
Css
CssCss
Css
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
 
Css basics
Css basicsCss basics
Css basics
 
Basic-CSS-tutorial
Basic-CSS-tutorialBasic-CSS-tutorial
Basic-CSS-tutorial
 
Basic css-tutorial
Basic css-tutorialBasic css-tutorial
Basic css-tutorial
 
Basic-CSS-tutorial
Basic-CSS-tutorialBasic-CSS-tutorial
Basic-CSS-tutorial
 
CSS Foundations, pt 2
CSS Foundations, pt 2CSS Foundations, pt 2
CSS Foundations, pt 2
 
Web technologies-course 03.pptx
Web technologies-course 03.pptxWeb technologies-course 03.pptx
Web technologies-course 03.pptx
 
WEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptxWEB TECHNOLOGY Unit-2.pptx
WEB TECHNOLOGY Unit-2.pptx
 
Css syntax, teachin presentation
Css syntax, teachin presentationCss syntax, teachin presentation
Css syntax, teachin presentation
 
Internet tech &amp; web prog. p4,5
Internet tech &amp; web prog.  p4,5Internet tech &amp; web prog.  p4,5
Internet tech &amp; web prog. p4,5
 
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...
 
Web Typography
Web TypographyWeb Typography
Web Typography
 
Web 101
Web 101Web 101
Web 101
 
Css Founder.com | Cssfounder in
Css Founder.com | Cssfounder inCss Founder.com | Cssfounder in
Css Founder.com | Cssfounder in
 
Web Programming& Scripting Lab
Web Programming& Scripting LabWeb Programming& Scripting Lab
Web Programming& Scripting Lab
 
IT2255 Web Essentials - Unit II Web Designing
IT2255 Web Essentials - Unit II  Web DesigningIT2255 Web Essentials - Unit II  Web Designing
IT2255 Web Essentials - Unit II Web Designing
 
Intro to html, css & sass
Intro to html, css & sassIntro to html, css & sass
Intro to html, css & sass
 

Kürzlich hochgeladen

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 

Kürzlich hochgeladen (20)

WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 

CSS

  • 1.
  • 2. What we will talk about: •HTML and CSS •CSS Selectors •CSS Properties •Cascade •Media Queries •Animations
  • 3. Client-side coding includes HTML, CSS and Javascript. This just means that the code rendered in the browser.
  • 5.
  • 6. HTML Document Hierarchy: Parents, children and siblings HTML elements are described in terms of relationships. All elements in the document have a parent (up to ‘document’, which is at the top), and may have children (nested inside) or siblings (placed alongside). <parent x> <child and sibling y> </child and sibling y> <child and sibling z> </child and sibling z> </parent x>
  • 8. •A style sheet isaset of rulesdefining how an html element will be“presented” in the browser •Theserules are targeted to specific elements in the html document(DOM) Style Sheet
  • 9. Style sheet linking types • 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. • User Style sheets Contains the user created styles • Browser default style sheet Contains default styles for all users of a browser
  • 11. CSSSyntax Syntax = the rules for how to write the language
  • 12. Three terms for describing yourstyles: CSSrule CSS selector CSS declaration
  • 13. CSSRule selector {property: value;} Every style is defined by a selector and a declaration. The declaration contains at least one property/value pair.Together they are called a CSS Rule. declaration
  • 14. CSSDeclaration You can apply multiple declarations to a selector(s) by separating the delcarations with semi-colons. sans-serif; p { font-family: Arial, font-size: 14px; color: #666666; }
  • 15. CSSSelectors p Type (element) # ID . Class [] Attribute * Universal
  • 16. Type (element)Selectors body {declaration} p {declaration} h1 {declaration} ul {declaration} The simplest selector is the type selector,which targets an html element by name.
  • 17. The essential selector types(elements) Primary Structur e Body Element s Formatting Elements html p em body br i h1 – h6 strong ul b ol q a blockquote img div span
  • 18. IDSelectors CSS #logo {declaration} HTML <img id=”logo” src=”” alt=””> An ID is an html attribute that is added to your html markup. You reference that ID in your css with a hash.
  • 19. ClassSelectors CSS .ingredients {declaration} HTML <ul class=”ingredients”> A class is an html attribute that is added toyour html markup. You reference that ID in your css with a period.
  • 20. Attribute selectors Attribute selectors selects elements based upon the attributes present in the HTMLTags and their value. IMG[src="small.gif"] { border: 1px solid #000; } will work for <img src=“small.gif” />
  • 21. CSS Pseudo-classes selector:pseudo-class { property: value } :link :visited } Link (A tag) related pseudo classes :hover :active :after :before :first-child :focus :first-letter :first-line :lang
  • 23. Universal selectors Universal selectors are used to select any element. * { color: blue; }
  • 24. Grouping • Multiple selectors can be grouped in a single style declaration by using , . H1, P , .main { font-weight:bold; }
  • 25. Combinators • Descendant combinatory • Child > combinatory • General ~ sibling • Adjacent + sibling
  • 26. Categories of CSS Properties • Positioning and layout handling related. • Background related properties. • Font and text related • Links related. • Lists related. • Table related.
  • 27. CSSValues • 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. • AbsoluteValues – in, pc, px, cm, mm, pt • RelativeValues – em, ex, % • Color values: color:#336699 or color#369.
  • 28. Color properties • Color • Named color • Hex(#) • rgb()/rgba() • hsl()/hsla() • Opacity
  • 29. Basic text properties • Text-decoration: overline | underline | line - through • Text-transform: none | lowercase | uppercase | capitalize • Text-shadow (2px, 2px, grey) Basic font properties • font-style: normal| italic | oblique • Font-weight: normal | bold | bolder | light | lighter | # • Font-size: {length} • font-family: {font}
  • 31. Sizing • width • height • min/max prefixes • box-sizing : content-box | border-box Visibility • display: inline| block | inline-block • visibility : visible | hidden • white-space : normal | pre | nowrap | … • overflow : visible | hidden | scroll | auto
  • 32. Cascade • It ultimately determines which css properties will apply to a given element • cascade is tied to three main concepts – Importance – Specificity – Inheritance
  • 33. Importance • Style sheets can have a few different sources User agent(browser styles), User(user’s browser options), Author(inline, embedded or external) • “!important” declaration – balance the priority of user and author style • Ascending order of importance User agent declarations User declarations Author declarations Author !important declarations User !important declarations
  • 34. Specificity • Specificity refers to how specific your selector isin naming anelement • Every CSS rule has a particular weight • This weight defines which properties will be applied to an element when there are conflicting rules. • If one rule is more specific than another, it overrides others. • Two rules share the same weight, source and specificity, the later one is applied.
  • 35.
  • 36.
  • 37. Inheritance • Inheritance is a way of propagating property values from parent elements to their children • When an element inherits a value from its parent, it is inheriting its computed value • Not all properties are inherited(e.g – padding, margin, border..etc), but you can force ones to be by using the ”inherit” value(e.g p {border: inherit}) • No specificity(lowest priority)
  • 38.
  • 39. • Made it possible to define different style rules for different media types.(computer screens, printers, handheld devices..etc) • Syntax @media mediatype and (expressions) { CSS-Code; } • Result of the query is true if the specified media type matches the type of device the document is being displayed on and all expressions in the media query are true. When a media query is true, the corresponding style sheet or style rules are applied, following the normal cascading rules. Media Queries
  • 40. • CSS animations allows animation of most HTML elements without using JavaScript or Flash! • @keyframes name{ from CSS-Code; to CSS-Code ; } When you specify CSS styles inside the keyframes the animation will gradually change from the current style to the new style at certain times. • To get an animation to work, you must bind the animation to an element. • selector { animation-name: name; animation-duration: time; } • http://www.hongkiat.com/blog/creative-css-animations/ Animation
  • 41. Some things you can change with CSS colors type type size backgrounds spacing sizes borders positions (layout) Some things you can’t change with CSS content markup
  • 42. Exercise • Design a responsive online shopping cart by using html and css (no JavaScript).
  • 43. • http://www.w3schools.com/css/default.asp • https://www.smashingmagazine.com/2010/04/css-specificity-and- inheritance/ • http://carl.camera/?id=95 • https://www.smashingmagazine.com/2010/04/css-specificity-and- inheritance/ References