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 (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 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 essentialsQA TrainingHub
 
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 3Binu Paul
 
Webpage style with CSS
Webpage style with CSSWebpage style with CSS
Webpage style with CSSHemant Patidar
 
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,5Taymoor Nazmy
 
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 layoutCK 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
 
Unit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.pptUnit 2-CSS & Bootstrap.ppt
Unit 2-CSS & Bootstrap.pptTusharTikia
 
Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Howcssworks 100207024009-phpapp01
Howcssworks 100207024009-phpapp01Likitha47
 
CSS Foundations, pt 2
CSS Foundations, pt 2CSS Foundations, pt 2
CSS Foundations, pt 2Shawn Calvert
 
DW_lesson2.ppt
DW_lesson2.pptDW_lesson2.ppt
DW_lesson2.pptPramenathA
 

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

Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Delhi Call girls
 
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneVIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneCall girls in Ahmedabad High profile
 
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Deliverybabeytanya
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirtrahman018755
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607dollysharma2066
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneRussian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneCall girls in Ahmedabad High profile
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 

Recently uploaded (20)

Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneVIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
 
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on DeliveryCall Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
Call Girls In Mumbai Central Mumbai ❤️ 9920874524 👈 Cash on Delivery
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneRussian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 

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)