SlideShare a Scribd company logo
1 of 47
Cascading Style Sheets
FFW
Toni Kolev
Quality Assurance Team Leader
e: toni.kolev@ffwagency.com
s: k-o-l-e-v
todayโ€™s agenda
01
02
03
04
05
06
07
08
What is CSS?
CSS Introduction
CSS Philosophy
CSS Syntax
Why Cascading?
Cascading Order
Style Inheritance
CSS, HTML and Media
todayโ€™s agenda (2)
09
10
11
12
13
14
15
16
How to CSS?
CSS Selectors
CSS Nested Selectors
CSS Attribute Selectors
Combine CSS Selectors
Pseudo Selectors
CSS Values โ€“ Types, Ranges, Units
Defining Size Values
todayโ€™s agenda (3)
17
18
19
20
21
22
23
24
Color Values
Default Browser Styles
Order of style definitions
Selector Priority
Text-Related CSS Properties
Backgrounds
Borders, Margins and Paddings
Width and Height
todayโ€™s agenda (4)
25
26
27
28
Display
Visibility
Positioning
Live demo
Cascading Style Sheets
What is CSS?
CSS Introduction
โ€ขUsed to describe the presentation of documents
โ€ขDefine sizes, spacing, fonts, colors, layout, etc.
โ€ขImprove content accessibility
โ€ขImprove flexibility
โ€ขDesigned to separate presentation from content
โ€ขDue to CSS, all HTML presentation tags and attributes are
deprecated
CSS: Philosophy
CSS โ€“ Cascading Style Sheets
CSS is used for styling elements on web pages and
manipulating their position, colors, sizes, etc.
CSS: Syntax
The CSS syntax is very easy to learn
and if you follow the best practices โ€“
you can achieve very maintainable code that can be
improved easily with the time.
Style Sheets Syntax
Let's say we have a div element with class โ€œffwโ€.
<div class=โ€ffwโ€>Div element</div>
We have a selector and declarations which define what
manipulations we are making to the element.
Selector {
property: value;
}
.ffw {
background-color: blue;
}
CSS: Why Cascading?
CSS is a cascading language. The main
definitions form that cascade.
CSS: Why Cascading?
These definitions are:
1)The main style which comes from the browser for the given
markup.
2) The styles which the user has declared.
3)The styles which are linked / added from the author of the
document.
The cascade justifies that there are several ways of styling a HTML
element. The best practice is to set general settings for all elements and
then become more concrete.
CSS: Style Inheritance
The inheritance in CSS means that the selectors
which are declared in our Style sheets โ€“ inherit the
property values from their parent selectors.
Example
HTML
<div class=โ€parentโ€>
<div class=โ€childโ€>
Parent Div
</div>
</div>
CSS
.parent {
font-size: 20px;
}
.child {
font-size: 15px;
}
CSS, HTML and Media
CSS can be used not only for HTML documents. It is used
in other programming languages for styling applications
and so on.
Media queries can be used for defining styles for
tablets, mobiles, TVs, Printing, etc.
@media (max-width), @media(min-width),
Media Queries
Let's say we have div element with width: 500px.
And we want to make this div 250px long for screens with
maximum width of 420px.
We declare this in our stylesheets:
@media(max-width: 420px) {
.div-class {
width: 250px;
}
}
How to CSS?
Three ways to Insert CSS. As we mentioned in Why Cascading โ€“ we can add
CSS to our document in three ways:
- External Style Sheet โ€“ this is when we create CSS file and put our definitions
inside and then we link to it in our document:
<link rel=โ€stylesheetโ€ href=โ€css/styles.cssโ€ type=โ€text/cssโ€ media=โ€allโ€>
- Internal Style Sheet โ€“ Defining our styles in the <head> part of our document,
by opening <style></style> tags and setting our rules.
- Inline Styles โ€“ This is not a good practice, but sometimes it is needed.
Setting inline styling happens when you write directly inside the html element.
Example:
<div class=โ€my-classโ€ style=โ€background-color: #BADA55;โ€></div>
CSS Selectors
The selectors are used for selecting elements for styling.
By tag
ul {
color: #BADA55;
}
By element ID
#my-id {
color: blue;
}
By class name
.my-class {
color: blue;
}
It is not a good practice, if not necessary, to use
element IDs for styling. IDs are used generally
for JS.
The best practice for styling elements with CSS
is to use CLASSES. (.my-class)
CSS Nested Selectors
The nested selectors can be used for being more specific when we define CSS
rules. Let's say we have 2 div elements with classes .my-class-1 and .my-class-
2:
<div class=โ€my-class-1โ€></div>
<ul>
<li></li>
</ul>
</div>
We want to style the UL in the first div. How to do it? We define the following
nesting properties in our style sheet:
.my-class-1 ul {
background-color: #FFWFFW;
}
<div class=โ€my-class-2โ€>
<ul>
<li></li>
</ul>
</div>
CSS Nested Selectors
If we have a div element with two UL elements inside and we want to style only
the first one โ€“ we can do it in the following way:
<div class=โ€my-parent-classโ€>
<ul>
<li></li>
</ul>
<ul>
<li></li>
</ul>
</div>
.my-parent-class > ul {
background-color: blue;
}
CSS Attribute Selectors
In CSS โ€“ we can style HTML elements using their attributes and/or attribute
values.
That way โ€“ we select every a element with target attribute and value = โ€œ_blankโ€
HTML
<a href=โ€#โ€ target=โ€_blankโ€>
CSS
a[target=โ€_blankโ€] {
background-color: blue;
}
Combine CSS Selectors
We can combine CSS selectors to be more specific which element we want to
style. Let's say we have:
If we have another CSS class - .first-class ั color:red,
our combined css selector โ€“ will win because it has more weight than the other
one.
HTML
<h1 class=โ€first-class second-classโ€></h1>
CSS
.first-class.second-class {
color: blue;
}
We can combine CSS selectors to be more specific which element w
If we have another CSS class - .first-class ั color:red,
our combined css selector โ€“ will win because it has more weight th
HTML
<h1 class=โ€first-class second-classโ€></h1>
CSS
.first-class.second-class {
color: blue;
}
Pseudo Selectors
The pseudo selectors are used for styling elements in
specific states.
:hover, :visited, :active
:first-line, :first-child, :before, :after
HTML
<a href=โ€http://ffwagency.comโ€>FFW Agency</a>
CSS
a {
color: yellow;
}
a:hover {
color: blue;
}
Pseudo Selectors
There are many benefits when using pseudo selectors.
They allow us to be very specific when we select HTML
elements.
Let's say we have a UL with 3 li elements inside and we want to select only the FIRST li
element.
HTML
<ul>
<li>First</li>
<li>Second</li>
<li>Third</li>
</ul>
CSS
ul li:first-child {
color: blue;
}
Selecting all li elements EXCEPT the first child
ul li:not(:first-child) {
color: red;
}
CSS Values โ€“ Types, Ranges, Units
All values in CSS are strings
i.e. 20px means size 20 pixels
The colors can be set in a red-green-blue format (RGB)
Both in HEX and Decimal
menu { color: #443344; }
menu { color: rgb(100, 200, 300); }
Defining Size Values
When setting any size (width, height, font-size,
etc.) - the values are given as numbers
We can use multiple formats like Pixels, ems, rems, e.g. 12px, 1.5em,
1.2rem
We can use Points, inches, centimeters, millimeters: 10pt, 1in, 1cm, 1mm
More formats: Percentages, e.g. 50%
The zero value can be used with no unit, e.g. width: 0;
Color Values
HEX, RGB, RGBA, HSL, HSLA
color: #000000; โ€“ HEX
color: rgb(0,0,0); โ€“ RGB (RED GREEN BLUE)
color: rgb(0,0,0,0.3) โ€“ RGB with Alpha (OPACITY)
color: hsl(120, 100%, 50%); - GREEN
color: hsla(120, 100%, 50%, 0.3) โ€“ GREEN with
Alpha
Opacity takes value from 0.0 to 1.
HEX, RGB, RGBA, HSL, HSLA
color: #000000; โ€“ HEX
color: rgb(0,0,0); โ€“ RGB (RED GREEN BLUE)
color: rgb(0,0,0,0.3) โ€“ RGB with Alpha (OPACITY)
color: hsl(120, 100%, 50%); - GREEN
color: hsla(120, 100%, 50%, 0.3) โ€“ GREEN with Alpha
Opacity takes value from 0.0 to 1.
Default Browser Styles
As we mentioned before โ€“ we have default styles
(margin, padding, fonts), which are predefined in our
browsers that we use and unfortunately โ€“ these styles
are not equal in all browsers.
Usually, front-end developers reset / normalize
the styles.
Order of Style Definitions
Conflicting style definitions are resolved by
PRIORITY.
1)External <link rel=โ€stylesheetโ€ href=โ€...โ€>
2)Styles in the <head><style>...</style></head>
3)Inline style attributes <div style=โ€...โ€>
4)Using !important
Text-Related CSS Properties
If we want to style a given text in CSS โ€“ we can
change its size, style, weight, position, etc. Here are
some examples:
1) font-size: 20px
2) font-weight: bold;
3) font-style: normal|italic|oblique|initial|inherit
4) text-decoration: none|underline|overline|line-through|initial|inherit
5) line-height: 1em
6) letter-spacing: 0.3em
7) text-align: left|right|center|justify
8) direction: ltr|rtl
Backgrounds
1) background-color: red;
2) background-image: url('../img/Image.svg');
3) background-repeat: no-repeat|repeat-y|repeat-y;
4) background-size: 50%;
5)http://www.w3schools.com/css/css_background.asp
Borders, Margins & Paddings
BORDER
border-top|border-bottom|border-left|border-right
border-style: dotted|solid|dashed;
Quick format
border: 1px solid #303003;
Margins
It defines the spacing outside the element.
For example โ€“ if we want to create spacing between every li element in our html
markup, we write this:
li { margin-top: 20px; }
We can also specify NEGATIVE margins which are legal and supported by all
browsers. E.g. margin-top: -20px;
Paddings
It defines the spacing inside the element.
Creating spacing above every li element, BUT inside the li element:
li { padding-top: 20px; }
Negative values are not supported, legal or logical for paddings!
Width and Height
Width and Height
We want our div element to have 1000px width and 200px height.
We define in our style sheets these properties:
.my-div {
width: 1000px;
height: 200px;
}
Display
We define our display type of the element. We have block elements, inline
elements, inline-block elements, etc. We can change their initial values by
defining CSS rules.
display: block;
display: inline-block;
display: none; - we hide the element from our visible area.
Visibility (visible, hidden)
We define our visible value of the element we have selected โ€“ to be visible or
hidden. If we make it hidden โ€“ we are hiding the element from the visible area,
but there will be blank space in the place where the element should appear.
visibility: visible; (That is the initial state)
visibility: hidden; - We hide the element
Box model
Positioning
The position definition specifies the type of positioning method used for an
element (static, relative, fixed or absolute).
Positioning
โ€ข position: static; - this is the default property
โ€ข position: relative; - positioning the element to its normal position and we can
move the element with the top,right,bottom and left properties.
โ€ข .div { position: relative; top: 20px; }
โ€ข position: fixed; - the element is positioned relative to the viewport. The element
will always stay wherever we put it, even when we scroll the page.
โ€ข position: absolute; - the element will be positioned relatively to the nearest
positioned ancestor.
LIVE DEMO
Now I will show you some live demo, using most of
the things we talked about today, so you can see
everything in action.
CSS Reference
โ€ข CSS Tricks โ€“ http://css-tricks.com
โ€ข The CSS documentation at WebPlatform.org -
http://docs.webplatform.org/wiki/css
โ€ข CSS documentation at Mozilla โ€“
https://developer.mozilla.org/en-US/docs/CSS
โ€ข CSS3 tutorial - http://www.w3schools.com/css3/
FFW Gabrovo PMG - CSS
FFW Gabrovo PMG - CSS

More Related Content

What's hot

css v1 guru
css v1 gurucss v1 guru
css v1 guru
GuruPada Das
ย 
Introducing Cascading Style Sheets
Introducing Cascading Style SheetsIntroducing Cascading Style Sheets
Introducing Cascading Style Sheets
St. Petersburg College
ย 
Html and css
Html and cssHtml and css
Html and css
Sukrit Gupta
ย 
Basic-CSS-tutorial
Basic-CSS-tutorialBasic-CSS-tutorial
Basic-CSS-tutorial
tutorialsruby
ย 

What's hot (20)

Html
HtmlHtml
Html
ย 
Basic css
Basic cssBasic css
Basic css
ย 
css v1 guru
css v1 gurucss v1 guru
css v1 guru
ย 
Css
CssCss
Css
ย 
Unit 2 (it workshop)
Unit 2 (it workshop)Unit 2 (it workshop)
Unit 2 (it workshop)
ย 
Unit 3 (it workshop).pptx
Unit 3 (it workshop).pptxUnit 3 (it workshop).pptx
Unit 3 (it workshop).pptx
ย 
Intro to CSS
Intro to CSSIntro to CSS
Intro to CSS
ย 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
ย 
Cascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) helpCascading Style Sheets (CSS) help
Cascading Style Sheets (CSS) help
ย 
Introducing Cascading Style Sheets
Introducing Cascading Style SheetsIntroducing Cascading Style Sheets
Introducing Cascading Style Sheets
ย 
Html and css
Html and cssHtml and css
Html and css
ย 
Cascading style sheets - CSS
Cascading style sheets - CSSCascading style sheets - CSS
Cascading style sheets - CSS
ย 
Basic-CSS-tutorial
Basic-CSS-tutorialBasic-CSS-tutorial
Basic-CSS-tutorial
ย 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
ย 
Fundamental CSS3
Fundamental CSS3Fundamental CSS3
Fundamental CSS3
ย 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing world
ย 
Cascading Style Sheets - CSS
Cascading Style Sheets - CSSCascading Style Sheets - CSS
Cascading Style Sheets - CSS
ย 
Beginners css tutorial for web designers
Beginners css tutorial for web designersBeginners css tutorial for web designers
Beginners css tutorial for web designers
ย 
CSS
CSSCSS
CSS
ย 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
ย 

Similar to FFW Gabrovo PMG - CSS

CSS Overview
CSS OverviewCSS Overview
CSS Overview
Doncho Minkov
ย 
Web topic 15 1 basic css layout
Web topic 15 1  basic css layoutWeb topic 15 1  basic css layout
Web topic 15 1 basic css layout
CK Yang
ย 
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
ย 
Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01
Likitha47
ย 
CSS Foundations, pt 2
CSS Foundations, pt 2CSS Foundations, pt 2
CSS Foundations, pt 2
Shawn Calvert
ย 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
ssuser666f98
ย 

Similar to FFW Gabrovo PMG - CSS (20)

CSS.pptx
CSS.pptxCSS.pptx
CSS.pptx
ย 
CSS Overview
CSS OverviewCSS Overview
CSS Overview
ย 
Css training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentialsCss training tutorial css3 &amp; css4 essentials
Css training tutorial css3 &amp; css4 essentials
ย 
Cordova training - Day 2 Introduction to CSS 3
Cordova training - Day 2 Introduction to CSS 3Cordova training - Day 2 Introduction to CSS 3
Cordova training - Day 2 Introduction to CSS 3
ย 
CSS
CSS CSS
CSS
ย 
Webpage style with CSS
Webpage style with CSSWebpage style with CSS
Webpage style with CSS
ย 
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
ย 
Web topic 15 1 basic css layout
Web topic 15 1  basic css layoutWeb topic 15 1  basic css layout
Web topic 15 1 basic css layout
ย 
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...
ย 
Unit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.pptUnit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.ppt
ย 
Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01
ย 
CSS Foundations, pt 2
CSS Foundations, pt 2CSS Foundations, pt 2
CSS Foundations, pt 2
ย 
Css ms megha
Css ms meghaCss ms megha
Css ms megha
ย 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
ย 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
ย 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
ย 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
ย 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.ppt
ย 
Css
CssCss
Css
ย 
INTRODUCTIONS OF CSS
INTRODUCTIONS OF CSSINTRODUCTIONS OF CSS
INTRODUCTIONS OF CSS
ย 

Recently uploaded

6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
ย 
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
SUHANI PANDEY
ย 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
ย 
Low Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐Ÿฅต
Low Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐ŸฅตLow Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐Ÿฅต
Low Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐Ÿฅต
Chandigarh Call girls 9053900678 Call girls in Chandigarh
ย 
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRLLucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
imonikaupta
ย 
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort ServiceCall Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
SUHANI PANDEY
ย 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
SUHANI PANDEY
ย 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
SUHANI PANDEY
ย 
( Pune ) VIP Baner Call Girls ๐ŸŽ—๏ธ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls ๐ŸŽ—๏ธ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls ๐ŸŽ—๏ธ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls ๐ŸŽ—๏ธ 9352988975 Sizzling | Escorts | Girls Are Re...
nilamkumrai
ย 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
SUHANI PANDEY
ย 

Recently uploaded (20)

Top Rated Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
ย 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
ย 
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
ย 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
ย 
Low Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐Ÿฅต
Low Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐ŸฅตLow Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐Ÿฅต
Low Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐Ÿฅต
ย 
VVVIP Call Girls In Connaught Place โžก๏ธ Delhi โžก๏ธ 9999965857 ๐Ÿš€ No Advance 24HRS...
VVVIP Call Girls In Connaught Place โžก๏ธ Delhi โžก๏ธ 9999965857 ๐Ÿš€ No Advance 24HRS...VVVIP Call Girls In Connaught Place โžก๏ธ Delhi โžก๏ธ 9999965857 ๐Ÿš€ No Advance 24HRS...
VVVIP Call Girls In Connaught Place โžก๏ธ Delhi โžก๏ธ 9999965857 ๐Ÿš€ No Advance 24HRS...
ย 
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRLLucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
ย 
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort ServiceCall Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
ย 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
ย 
๐“€คCall On 7877925207 ๐“€ค Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
๐“€คCall On 7877925207 ๐“€ค Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...๐“€คCall On 7877925207 ๐“€ค Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
๐“€คCall On 7877925207 ๐“€ค Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
ย 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
ย 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
ย 
Call Now โ˜Ž 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now โ˜Ž 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now โ˜Ž 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now โ˜Ž 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
ย 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
ย 
Busty DesiโšกCall Girls in Vasundhara Ghaziabad >เผ’8448380779 Escort Service
Busty DesiโšกCall Girls in Vasundhara Ghaziabad >เผ’8448380779 Escort ServiceBusty DesiโšกCall Girls in Vasundhara Ghaziabad >เผ’8448380779 Escort Service
Busty DesiโšกCall Girls in Vasundhara Ghaziabad >เผ’8448380779 Escort Service
ย 
Call Now โ˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now โ˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now โ˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now โ˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
ย 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
ย 
( Pune ) VIP Baner Call Girls ๐ŸŽ—๏ธ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls ๐ŸŽ—๏ธ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls ๐ŸŽ—๏ธ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls ๐ŸŽ—๏ธ 9352988975 Sizzling | Escorts | Girls Are Re...
ย 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
ย 
Hireโ† Young Call Girls in Tilak nagar (Delhi) โ˜Ž๏ธ 9205541914 โ˜Ž๏ธ Independent Esc...
Hireโ† Young Call Girls in Tilak nagar (Delhi) โ˜Ž๏ธ 9205541914 โ˜Ž๏ธ Independent Esc...Hireโ† Young Call Girls in Tilak nagar (Delhi) โ˜Ž๏ธ 9205541914 โ˜Ž๏ธ Independent Esc...
Hireโ† Young Call Girls in Tilak nagar (Delhi) โ˜Ž๏ธ 9205541914 โ˜Ž๏ธ Independent Esc...
ย 

FFW Gabrovo PMG - CSS

  • 2. FFW Toni Kolev Quality Assurance Team Leader e: toni.kolev@ffwagency.com s: k-o-l-e-v
  • 3. todayโ€™s agenda 01 02 03 04 05 06 07 08 What is CSS? CSS Introduction CSS Philosophy CSS Syntax Why Cascading? Cascading Order Style Inheritance CSS, HTML and Media
  • 4. todayโ€™s agenda (2) 09 10 11 12 13 14 15 16 How to CSS? CSS Selectors CSS Nested Selectors CSS Attribute Selectors Combine CSS Selectors Pseudo Selectors CSS Values โ€“ Types, Ranges, Units Defining Size Values
  • 5. todayโ€™s agenda (3) 17 18 19 20 21 22 23 24 Color Values Default Browser Styles Order of style definitions Selector Priority Text-Related CSS Properties Backgrounds Borders, Margins and Paddings Width and Height
  • 8. CSS Introduction โ€ขUsed to describe the presentation of documents โ€ขDefine sizes, spacing, fonts, colors, layout, etc. โ€ขImprove content accessibility โ€ขImprove flexibility โ€ขDesigned to separate presentation from content โ€ขDue to CSS, all HTML presentation tags and attributes are deprecated
  • 9. CSS: Philosophy CSS โ€“ Cascading Style Sheets CSS is used for styling elements on web pages and manipulating their position, colors, sizes, etc.
  • 10. CSS: Syntax The CSS syntax is very easy to learn and if you follow the best practices โ€“ you can achieve very maintainable code that can be improved easily with the time.
  • 11. Style Sheets Syntax Let's say we have a div element with class โ€œffwโ€. <div class=โ€ffwโ€>Div element</div> We have a selector and declarations which define what manipulations we are making to the element. Selector { property: value; } .ffw { background-color: blue; }
  • 12. CSS: Why Cascading? CSS is a cascading language. The main definitions form that cascade.
  • 13. CSS: Why Cascading? These definitions are: 1)The main style which comes from the browser for the given markup. 2) The styles which the user has declared. 3)The styles which are linked / added from the author of the document. The cascade justifies that there are several ways of styling a HTML element. The best practice is to set general settings for all elements and then become more concrete.
  • 14. CSS: Style Inheritance The inheritance in CSS means that the selectors which are declared in our Style sheets โ€“ inherit the property values from their parent selectors. Example HTML <div class=โ€parentโ€> <div class=โ€childโ€> Parent Div </div> </div> CSS .parent { font-size: 20px; } .child { font-size: 15px; }
  • 15. CSS, HTML and Media CSS can be used not only for HTML documents. It is used in other programming languages for styling applications and so on. Media queries can be used for defining styles for tablets, mobiles, TVs, Printing, etc. @media (max-width), @media(min-width),
  • 16. Media Queries Let's say we have div element with width: 500px. And we want to make this div 250px long for screens with maximum width of 420px. We declare this in our stylesheets: @media(max-width: 420px) { .div-class { width: 250px; } }
  • 17. How to CSS? Three ways to Insert CSS. As we mentioned in Why Cascading โ€“ we can add CSS to our document in three ways: - External Style Sheet โ€“ this is when we create CSS file and put our definitions inside and then we link to it in our document: <link rel=โ€stylesheetโ€ href=โ€css/styles.cssโ€ type=โ€text/cssโ€ media=โ€allโ€> - Internal Style Sheet โ€“ Defining our styles in the <head> part of our document, by opening <style></style> tags and setting our rules. - Inline Styles โ€“ This is not a good practice, but sometimes it is needed. Setting inline styling happens when you write directly inside the html element. Example: <div class=โ€my-classโ€ style=โ€background-color: #BADA55;โ€></div>
  • 18. CSS Selectors The selectors are used for selecting elements for styling. By tag ul { color: #BADA55; } By element ID #my-id { color: blue; } By class name .my-class { color: blue; } It is not a good practice, if not necessary, to use element IDs for styling. IDs are used generally for JS. The best practice for styling elements with CSS is to use CLASSES. (.my-class)
  • 19. CSS Nested Selectors The nested selectors can be used for being more specific when we define CSS rules. Let's say we have 2 div elements with classes .my-class-1 and .my-class- 2: <div class=โ€my-class-1โ€></div> <ul> <li></li> </ul> </div> We want to style the UL in the first div. How to do it? We define the following nesting properties in our style sheet: .my-class-1 ul { background-color: #FFWFFW; } <div class=โ€my-class-2โ€> <ul> <li></li> </ul> </div>
  • 20. CSS Nested Selectors If we have a div element with two UL elements inside and we want to style only the first one โ€“ we can do it in the following way: <div class=โ€my-parent-classโ€> <ul> <li></li> </ul> <ul> <li></li> </ul> </div> .my-parent-class > ul { background-color: blue; }
  • 21. CSS Attribute Selectors In CSS โ€“ we can style HTML elements using their attributes and/or attribute values. That way โ€“ we select every a element with target attribute and value = โ€œ_blankโ€ HTML <a href=โ€#โ€ target=โ€_blankโ€> CSS a[target=โ€_blankโ€] { background-color: blue; }
  • 22. Combine CSS Selectors We can combine CSS selectors to be more specific which element we want to style. Let's say we have: If we have another CSS class - .first-class ั color:red, our combined css selector โ€“ will win because it has more weight than the other one. HTML <h1 class=โ€first-class second-classโ€></h1> CSS .first-class.second-class { color: blue; }
  • 23. We can combine CSS selectors to be more specific which element w If we have another CSS class - .first-class ั color:red, our combined css selector โ€“ will win because it has more weight th HTML <h1 class=โ€first-class second-classโ€></h1> CSS .first-class.second-class { color: blue; }
  • 24. Pseudo Selectors The pseudo selectors are used for styling elements in specific states. :hover, :visited, :active :first-line, :first-child, :before, :after HTML <a href=โ€http://ffwagency.comโ€>FFW Agency</a> CSS a { color: yellow; } a:hover { color: blue; }
  • 25. Pseudo Selectors There are many benefits when using pseudo selectors. They allow us to be very specific when we select HTML elements. Let's say we have a UL with 3 li elements inside and we want to select only the FIRST li element. HTML <ul> <li>First</li> <li>Second</li> <li>Third</li> </ul> CSS ul li:first-child { color: blue; } Selecting all li elements EXCEPT the first child ul li:not(:first-child) { color: red; }
  • 26. CSS Values โ€“ Types, Ranges, Units All values in CSS are strings i.e. 20px means size 20 pixels The colors can be set in a red-green-blue format (RGB) Both in HEX and Decimal menu { color: #443344; } menu { color: rgb(100, 200, 300); }
  • 27. Defining Size Values When setting any size (width, height, font-size, etc.) - the values are given as numbers We can use multiple formats like Pixels, ems, rems, e.g. 12px, 1.5em, 1.2rem We can use Points, inches, centimeters, millimeters: 10pt, 1in, 1cm, 1mm More formats: Percentages, e.g. 50% The zero value can be used with no unit, e.g. width: 0;
  • 28. Color Values HEX, RGB, RGBA, HSL, HSLA color: #000000; โ€“ HEX color: rgb(0,0,0); โ€“ RGB (RED GREEN BLUE) color: rgb(0,0,0,0.3) โ€“ RGB with Alpha (OPACITY) color: hsl(120, 100%, 50%); - GREEN color: hsla(120, 100%, 50%, 0.3) โ€“ GREEN with Alpha Opacity takes value from 0.0 to 1.
  • 29. HEX, RGB, RGBA, HSL, HSLA color: #000000; โ€“ HEX color: rgb(0,0,0); โ€“ RGB (RED GREEN BLUE) color: rgb(0,0,0,0.3) โ€“ RGB with Alpha (OPACITY) color: hsl(120, 100%, 50%); - GREEN color: hsla(120, 100%, 50%, 0.3) โ€“ GREEN with Alpha Opacity takes value from 0.0 to 1.
  • 30. Default Browser Styles As we mentioned before โ€“ we have default styles (margin, padding, fonts), which are predefined in our browsers that we use and unfortunately โ€“ these styles are not equal in all browsers. Usually, front-end developers reset / normalize the styles.
  • 31. Order of Style Definitions Conflicting style definitions are resolved by PRIORITY. 1)External <link rel=โ€stylesheetโ€ href=โ€...โ€> 2)Styles in the <head><style>...</style></head> 3)Inline style attributes <div style=โ€...โ€> 4)Using !important
  • 32. Text-Related CSS Properties If we want to style a given text in CSS โ€“ we can change its size, style, weight, position, etc. Here are some examples: 1) font-size: 20px 2) font-weight: bold; 3) font-style: normal|italic|oblique|initial|inherit 4) text-decoration: none|underline|overline|line-through|initial|inherit 5) line-height: 1em 6) letter-spacing: 0.3em 7) text-align: left|right|center|justify 8) direction: ltr|rtl
  • 33. Backgrounds 1) background-color: red; 2) background-image: url('../img/Image.svg'); 3) background-repeat: no-repeat|repeat-y|repeat-y; 4) background-size: 50%; 5)http://www.w3schools.com/css/css_background.asp
  • 34. Borders, Margins & Paddings BORDER border-top|border-bottom|border-left|border-right border-style: dotted|solid|dashed; Quick format border: 1px solid #303003;
  • 35. Margins It defines the spacing outside the element. For example โ€“ if we want to create spacing between every li element in our html markup, we write this: li { margin-top: 20px; } We can also specify NEGATIVE margins which are legal and supported by all browsers. E.g. margin-top: -20px;
  • 36. Paddings It defines the spacing inside the element. Creating spacing above every li element, BUT inside the li element: li { padding-top: 20px; } Negative values are not supported, legal or logical for paddings!
  • 38. Width and Height We want our div element to have 1000px width and 200px height. We define in our style sheets these properties: .my-div { width: 1000px; height: 200px; }
  • 39. Display We define our display type of the element. We have block elements, inline elements, inline-block elements, etc. We can change their initial values by defining CSS rules. display: block; display: inline-block; display: none; - we hide the element from our visible area.
  • 40. Visibility (visible, hidden) We define our visible value of the element we have selected โ€“ to be visible or hidden. If we make it hidden โ€“ we are hiding the element from the visible area, but there will be blank space in the place where the element should appear. visibility: visible; (That is the initial state) visibility: hidden; - We hide the element
  • 42. Positioning The position definition specifies the type of positioning method used for an element (static, relative, fixed or absolute).
  • 43. Positioning โ€ข position: static; - this is the default property โ€ข position: relative; - positioning the element to its normal position and we can move the element with the top,right,bottom and left properties. โ€ข .div { position: relative; top: 20px; } โ€ข position: fixed; - the element is positioned relative to the viewport. The element will always stay wherever we put it, even when we scroll the page. โ€ข position: absolute; - the element will be positioned relatively to the nearest positioned ancestor.
  • 44. LIVE DEMO Now I will show you some live demo, using most of the things we talked about today, so you can see everything in action.
  • 45. CSS Reference โ€ข CSS Tricks โ€“ http://css-tricks.com โ€ข The CSS documentation at WebPlatform.org - http://docs.webplatform.org/wiki/css โ€ข CSS documentation at Mozilla โ€“ https://developer.mozilla.org/en-US/docs/CSS โ€ข CSS3 tutorial - http://www.w3schools.com/css3/

Editor's Notes

  1. HyperText Markup Language, commonly abbreviated as HTML, is the standard markup language used to create web pages. Initial release 1993 (23 years ago) Latest release 5.0 on 28 October 2014)
  2. HyperText Markup Language, commonly abbreviated as HTML, is the standard markup language used to create web pages. Initial release 1993 (23 years ago) Latest release 5.0 on 28 October 2014)