SlideShare a Scribd company logo
Cascading Style Sheets 3 (CSS3)
What’s CSS?
> CSS Stands for Cascading Style Sheets.
> It describes how HTML elements are to be
displayed on screen, paper, or in other media.
> External style sheets are stores in a (.css) file.
> Checkout same page, different style sheets here,
https://www.w3schools.com/css/css_intro.asp
Why CSS?
> CSS defines styles for our website. Everything will
look weird if we don’t style our web pages.
> Imagine living in a building without its wall being
painted!
> Moreover, we all want our customers / visitors to
spend some time on the website instead of just
closing them at once. Well, to stop them and gain
their first impression as the best one, we need to
have some awesome styles for the web page!
Where would you want to go is why you want to use CSS!
CSS Syntax CSS Selectors
That’s how we style it!
30 CSS Selector you must memorize: https://code.tutsplus.com/tutorials/the-30-css-selectors-you-must-memorize--net-16048
CSS vs CSS3
> Pseudo Classes (Limited)
[selector]:pseudo-class{
// CSS Code here
}
E.g.: :first-child
> No support for animations. Animations were added using
JavaScript & jQuery (a JavaScript library).
> Before CSS3 developers used to develop images that looked like
rounded corners.
> Not compatible with CSS3
> Much more pseudo classes
E.g.: :nth-child()
:root
:empty
> Supports text shadow
> Supports animations
> Supports border-radius & gradient
> Backward Compatible to CSS
> They load faster and time required to write them is lesser as
compared to that of CSS.
Cascading Specificity Inheritance
What do you think h1 will be colored as?
Cascading means that the order
of CSS rules matter. When two
rules apply that have equal
specificity, the latter one will be
used.
Specificity basically is a measure of the
CSS rule priority.
In simple words, it is how the browser
decides which rule applies if multiple rules
have different selectors
Here, class has greater specificity than
the HTML tag itself [Rule]
Some CSS property values set on parent
elements are inherited by their child
elements, and some aren't.
For example, if you set a color and
font-family on an element, every element
inside it will also be styled with that color
and font, unless you've applied different
color and font values directly to them.
Some properties do not inherit — for
example if you set a width of 50% on an
element, all of its descendants do not get
a width of 50% of their parent's width.
Which properties are inherited by default
and which aren't is largely down to
common sense.
Controlling CSS Inheritance - ( inherit, initial, unset, revert, all )
Takes computed value from the parent.
Sets a property to its initial value defined
on a per-property basis by the CSS
specifications..
Sets a property to its inherited value if it inherits,
or to its initial value if not.
https://jsbin.com/sayodab/1/edit?html,css,output
New additions:
> revert :
It resets the property to its inherited value if it
inherits from its parent or to the default value
established by the user agent stylesheet (or by user
styles, if any exist).
User Agent Style sheets simply refer to the default styles that
browsers apply to web pages.
> all :
Can be used to apply one of these inheritance
values to (almost) all properties at once.
https://jsbin.com/livugin/1/edit?html,css,output
# Unset vs Revert (Important)
https://jsbin.com/famagez/2/edit?html,css,output
Not same
More on Cascade
Source Order
If you have more than one
rule, which has exactly the
same weight, then the one
that comes last in the CSS
will win.
Specificity
1) Inline Style - 1000
2) Id selector - 100
3) Class selector (.class, [attributes], :pseudo-class, :hover, :focus, etc.) - 10
4) Element / Tag & Pseudo Elements (h1, :pseudo-elements, :before, :after, :first-element, etc.) - 1
5) :not, * - 0
6) !important - 10,000
Note:
1) The universal selector (*), combinators (+, >, ~, ' '), and negation pseudo-class (:not) have no effect
on specificity.
2) Inline > Internal > External
101
100
11
CSS Box Model - 1
> Normal : Inline Block
> The box will not break into new line.
> Width & height properties will not apply.
> Only horizontal paddings, margins and borders will apply and will
cause other boxes to move away from them.
> Vertical padding won’t apply.
https://jsbin.com/zexolib/2/edit?html,css,output
> E.g. <a>, <span>, <em>, <strong>, etc.
> The box will break into new line.
> Width & height properties are respected.
> Will cover at max 100% by default.
> All padding, margin and borders will cause other boxes to move
away.
> E.g. <div>, <h1>, <p>, etc.
> Not Normal : Flex
> When flex is set, the outer display turns to block but the inner
display is set to flex.
> Inline Flex
CSS Box Model - 2
Standart Box Model Alternative Box Model
> In this model, the content area of box =
(total-width of box - border / padding).
> Can be set via:
box-sizing: border-box
> Applying everywhere only once:
> Default
> total width = content-area of box
> padding & border are added
separately.
> Can be set via:
box-sizing: content-box
You know where to find me!
webcrat.tech@gmail.com
PS. Keep the subject line as:
[ Web Dev BootCamp ‘ 20 ]
Github @webber2408
LinkedIn @rahul-sharma-25b30b114
Medium @webcrat.tech
References
> Amazon.com
> Undraw.co
> Icons made by Freepik from www.flaticon.com
> MDN (HTML): https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/Getting_started
> MDN (CSS - Important): https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks
> W3Schools: https://www.w3schools.com/html/
> HTML Semantics: vikingcodeschool.com/html5-and-css3/html5-semantic-tags
> WikiPedia: https://en.wikipedia.org/wiki/Semantic_HTML

More Related Content

PPT
CSS Part I
ODP
Cascading Style Sheets - Part 02
PPT
CSS Methodology
PDF
SMACSS Workshop
PDF
CSS - OOCSS, SMACSS and more
PDF
Dominate The Theme Layer
PPTX
Hardcore CSS
PDF
CSS Reset
CSS Part I
Cascading Style Sheets - Part 02
CSS Methodology
SMACSS Workshop
CSS - OOCSS, SMACSS and more
Dominate The Theme Layer
Hardcore CSS
CSS Reset

What's hot (20)

PPT
CSS Part II
PDF
Introduction to CSS3
KEY
The Fast And The Fabulous
PPTX
PPT
An Introduction to CSS
PDF
Fundamental CSS3
PPTX
CSS101 - Concept Fundamentals for non UI Developers
PDF
Pemrograman Web 3 - CSS Basic Part 2
PDF
Pemrograman Web 2 - CSS
PPTX
Css3 Presetation
PDF
CSS Box Model
PDF
LESS CSS Pre-processor
PPT
LESS(CSS preprocessor)
PPTX
Div Tag Tutorial
PDF
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
PPTX
Languages for web(HTML,CSS,JS)
PDF
[Worskhop Summits] CSS3 Workshop
PPT
Intro to CSS Selectors in Drupal
CSS Part II
Introduction to CSS3
The Fast And The Fabulous
An Introduction to CSS
Fundamental CSS3
CSS101 - Concept Fundamentals for non UI Developers
Pemrograman Web 3 - CSS Basic Part 2
Pemrograman Web 2 - CSS
Css3 Presetation
CSS Box Model
LESS CSS Pre-processor
LESS(CSS preprocessor)
Div Tag Tutorial
Object-Oriented CSS 從 OOCSS, SMACSS, BEM 到 AMCSS
Languages for web(HTML,CSS,JS)
[Worskhop Summits] CSS3 Workshop
Intro to CSS Selectors in Drupal
Ad

Similar to Introduction to CSS3 (20)

PPTX
Module 2 CSS . cascading style sheet and its uses
PPTX
PDF
ch-hguygureehuvnvdfduyertiuhrnhduuyfjh3.pdf
PPTX
Css specificity inheritance and the cascade things you should know
PPT
3 css essentials
PPT
CSS Essentials for Website Development.ppt
PPT
3-CSS_essentials.ppt
PPT
3-CSS_essentials.ppt
PPT
3-CSS_essentials_developers_begineers.ppt
PPT
3-CSS_essentials introduction slides.ppt
PPTX
CSS Fundamentals: selectors and Properties
PPTX
FFW Gabrovo PMG - CSS
PDF
Chapterrr_8_Introduction to CSS.pptx.pdf
PDF
CSS3 and Responsive Web Design - Web Technologies (1019888BNR)
PPTX
Beginners css tutorial for web designers
PPTX
Designing for the web - 101
PPTX
Web - CSS 1.pptx
PPT
Basic Knowldege about CSS Prepared for VV softech solution (2).ppt
PPT
Basic css
PPTX
Cascading Styling Sheets(CSS) simple design language intended to transform th...
Module 2 CSS . cascading style sheet and its uses
ch-hguygureehuvnvdfduyertiuhrnhduuyfjh3.pdf
Css specificity inheritance and the cascade things you should know
3 css essentials
CSS Essentials for Website Development.ppt
3-CSS_essentials.ppt
3-CSS_essentials.ppt
3-CSS_essentials_developers_begineers.ppt
3-CSS_essentials introduction slides.ppt
CSS Fundamentals: selectors and Properties
FFW Gabrovo PMG - CSS
Chapterrr_8_Introduction to CSS.pptx.pdf
CSS3 and Responsive Web Design - Web Technologies (1019888BNR)
Beginners css tutorial for web designers
Designing for the web - 101
Web - CSS 1.pptx
Basic Knowldege about CSS Prepared for VV softech solution (2).ppt
Basic css
Cascading Styling Sheets(CSS) simple design language intended to transform th...
Ad

More from RAHUL SHARMA (6)

PDF
Introduction to Web Development
PDF
Introduction to HTML 5
PDF
Webpack presentation
PDF
Introduction to Mixins & OOPS
PDF
ECMAScript (2015 - 2019)
PDF
Mixins & OOPS in JavaScript
Introduction to Web Development
Introduction to HTML 5
Webpack presentation
Introduction to Mixins & OOPS
ECMAScript (2015 - 2019)
Mixins & OOPS in JavaScript

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
1. Introduction to Computer Programming.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Mushroom cultivation and it's methods.pdf
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Approach and Philosophy of On baking technology
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
Digital-Transformation-Roadmap-for-Companies.pptx
A comparative analysis of optical character recognition models for extracting...
SOPHOS-XG Firewall Administrator PPT.pptx
Univ-Connecticut-ChatGPT-Presentaion.pdf
1. Introduction to Computer Programming.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Encapsulation_ Review paper, used for researhc scholars
TLE Review Electricity (Electricity).pptx
Mushroom cultivation and it's methods.pdf
OMC Textile Division Presentation 2021.pptx
Empathic Computing: Creating Shared Understanding
Programs and apps: productivity, graphics, security and other tools
NewMind AI Weekly Chronicles - August'25-Week II
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Per capita expenditure prediction using model stacking based on satellite ima...
cloud_computing_Infrastucture_as_cloud_p
Building Integrated photovoltaic BIPV_UPV.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Approach and Philosophy of On baking technology
Group 1 Presentation -Planning and Decision Making .pptx

Introduction to CSS3

  • 2. What’s CSS? > CSS Stands for Cascading Style Sheets. > It describes how HTML elements are to be displayed on screen, paper, or in other media. > External style sheets are stores in a (.css) file. > Checkout same page, different style sheets here, https://www.w3schools.com/css/css_intro.asp Why CSS? > CSS defines styles for our website. Everything will look weird if we don’t style our web pages. > Imagine living in a building without its wall being painted! > Moreover, we all want our customers / visitors to spend some time on the website instead of just closing them at once. Well, to stop them and gain their first impression as the best one, we need to have some awesome styles for the web page! Where would you want to go is why you want to use CSS!
  • 3. CSS Syntax CSS Selectors That’s how we style it! 30 CSS Selector you must memorize: https://code.tutsplus.com/tutorials/the-30-css-selectors-you-must-memorize--net-16048
  • 4. CSS vs CSS3 > Pseudo Classes (Limited) [selector]:pseudo-class{ // CSS Code here } E.g.: :first-child > No support for animations. Animations were added using JavaScript & jQuery (a JavaScript library). > Before CSS3 developers used to develop images that looked like rounded corners. > Not compatible with CSS3 > Much more pseudo classes E.g.: :nth-child() :root :empty > Supports text shadow > Supports animations > Supports border-radius & gradient > Backward Compatible to CSS > They load faster and time required to write them is lesser as compared to that of CSS.
  • 5. Cascading Specificity Inheritance What do you think h1 will be colored as? Cascading means that the order of CSS rules matter. When two rules apply that have equal specificity, the latter one will be used. Specificity basically is a measure of the CSS rule priority. In simple words, it is how the browser decides which rule applies if multiple rules have different selectors Here, class has greater specificity than the HTML tag itself [Rule] Some CSS property values set on parent elements are inherited by their child elements, and some aren't. For example, if you set a color and font-family on an element, every element inside it will also be styled with that color and font, unless you've applied different color and font values directly to them. Some properties do not inherit — for example if you set a width of 50% on an element, all of its descendants do not get a width of 50% of their parent's width. Which properties are inherited by default and which aren't is largely down to common sense.
  • 6. Controlling CSS Inheritance - ( inherit, initial, unset, revert, all ) Takes computed value from the parent. Sets a property to its initial value defined on a per-property basis by the CSS specifications.. Sets a property to its inherited value if it inherits, or to its initial value if not. https://jsbin.com/sayodab/1/edit?html,css,output New additions: > revert : It resets the property to its inherited value if it inherits from its parent or to the default value established by the user agent stylesheet (or by user styles, if any exist). User Agent Style sheets simply refer to the default styles that browsers apply to web pages. > all : Can be used to apply one of these inheritance values to (almost) all properties at once. https://jsbin.com/livugin/1/edit?html,css,output # Unset vs Revert (Important) https://jsbin.com/famagez/2/edit?html,css,output Not same
  • 7. More on Cascade Source Order If you have more than one rule, which has exactly the same weight, then the one that comes last in the CSS will win. Specificity 1) Inline Style - 1000 2) Id selector - 100 3) Class selector (.class, [attributes], :pseudo-class, :hover, :focus, etc.) - 10 4) Element / Tag & Pseudo Elements (h1, :pseudo-elements, :before, :after, :first-element, etc.) - 1 5) :not, * - 0 6) !important - 10,000 Note: 1) The universal selector (*), combinators (+, >, ~, ' '), and negation pseudo-class (:not) have no effect on specificity. 2) Inline > Internal > External 101 100 11
  • 8. CSS Box Model - 1 > Normal : Inline Block > The box will not break into new line. > Width & height properties will not apply. > Only horizontal paddings, margins and borders will apply and will cause other boxes to move away from them. > Vertical padding won’t apply. https://jsbin.com/zexolib/2/edit?html,css,output > E.g. <a>, <span>, <em>, <strong>, etc. > The box will break into new line. > Width & height properties are respected. > Will cover at max 100% by default. > All padding, margin and borders will cause other boxes to move away. > E.g. <div>, <h1>, <p>, etc. > Not Normal : Flex > When flex is set, the outer display turns to block but the inner display is set to flex. > Inline Flex
  • 9. CSS Box Model - 2 Standart Box Model Alternative Box Model > In this model, the content area of box = (total-width of box - border / padding). > Can be set via: box-sizing: border-box > Applying everywhere only once: > Default > total width = content-area of box > padding & border are added separately. > Can be set via: box-sizing: content-box
  • 10. You know where to find me! [email protected] PS. Keep the subject line as: [ Web Dev BootCamp ‘ 20 ] Github @webber2408 LinkedIn @rahul-sharma-25b30b114 Medium @webcrat.tech
  • 11. References > Amazon.com > Undraw.co > Icons made by Freepik from www.flaticon.com > MDN (HTML): https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/Getting_started > MDN (CSS - Important): https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks > W3Schools: https://www.w3schools.com/html/ > HTML Semantics: vikingcodeschool.com/html5-and-css3/html5-semantic-tags > WikiPedia: https://en.wikipedia.org/wiki/Semantic_HTML