SlideShare une entreprise Scribd logo
1  sur  35
1
CSS WALKTHROUGH
INTERNSHIP, SEPTEMBER 2019
2
2
AGENDA
▪ CSS
 WHAT IT IS
 HOW TO INCLUDE CSS IN A PAGE
 SELECTORS
 SPECIFICITY
 UNITS & COLORS
 BOX MODEL
 POSITIONING ELEMENTS
 Z-INDEX
 DISPLAY MODEL
 DISPLAY FLEX
 FLOAT
 CALC()
 MEDIA QUERIES
3
3
CSS – WHAT DOES IT MEAN
Stands for Cascading Style Sheets.
Defines how HTML elements are to be displayed in the browser.
Cascading means that styles can fall (or cascade) from one style sheet to another, enabling multiple style sheets to
be used on one HTML document.
4
4
INLINE STYLE
<!DOCTYPE html>
<html>
<head>
<title>Inline CSS</title>
</head>
<body>
<div class="ninja" style="color: black;" >
Black ninja
</div>
</body>
</html>
CSS – INLINE, INTERNAL, EXTERNAL
5
5
CSS – INLINE, INTERNAL, EXTERNAL
INTERNAL CSS
<!DOCTYPE html>
<html>
<head>
<title>Inline CSS</title>
<style type="text/css">
.ninja {
color: black;
}
</style >
</head>
<body>
<div class="ninja">Black ninja</div>
</body>
</html>
6
6
CSS – INLINE, INTERNAL, EXTERNAL
EXTERNAL CSS
<!DOCTYPE html>
<html>
<head>
<title>Inline CSS</title>
<link href="css/styles.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div class="ninja">Black ninja</div>
</body>
</html>
7
7
CSS – ANATOMY OF A CSS SELECTOR
CSS selectors allow to select and manipulate HTML elements.
8
8
CSS – SELECTOR TYPES
TAG SELECTOR - matches element names.
h1, p, div, span {
display: block;
}
CLASS SELECTOR - selects elements which have
a given class
.box, div.box {
background: blue;
}
ID SELECTOR - selects elements which have a given id
#search {
border: 1px solid black;
}
ATTRIBUTE - selects elements by their attributes
[href] {
cursor: pointer;
}
9
9
CSS – SELECTOR TYPES
GROUP - used to group together multiple selectors into one.
p, a, .a-class-name {
font-size: 18px;
}
DESCENDANTS - select elements that are descendants of other elements
• they don’t have to be immediate children.
div a {
font-size: 18px;
}
• they have to be immediate children.
div > a {
font-size: 18px;
}
10
10
CSS – PSEUDO CLASSES & ELEMENTS
PSEUDO CLASS - is a keyword added to selectors that specifies a special state of the element to be selected:
E.g.: active, focus, hover, link, visited, etc.
a:hover {
color: red;
}
PSEUDO ELEMENT - is a keyword added to selectors that allow to style certain parts of a document.
E.g.: after, before, first-letter, first-line, etc.
a:before {
content: ">";
}
11
11
CSS – SPECIFICITY
SPECIFICITY is the means by which browsers decide which CSS property values are the most relevant to an element
and, therefore, will be applied. Specificity is based on the matching rules which are composed of different sorts of
CSS selectors.
12
12
CSS – SPECIFICITY
Sample calculation:
13
13
CSS – SPECIFICITY
• Pseudo-elements (e.g. :before) get (0,0,0,1) unlike their pseudo-class (e.g. :hover) brethren which
gets (0,0,1,0)
• The !important value appended a CSS property value is an automatic win. It overrides even inline styles from
the markup. The only way an !important value can be overridden is with another !important rule declared
later in the CSS and with equal or great specificity value otherwise. You could think of it as adding (1,0,0,0,0)
to the specificity value.
14
14
CSS – SPECIFICITY
Example:
<ul id="summer-drinks">
<li class="favorite">Whiskey and Ginger Ale</li>
<li>Wheat Beer</li>
<li>Mint Julip</li>
</ul>
ul#summer-drinks li {
font-weight: normal;
font-size: 12px;
color: black;
}
15
15
CSS – MEASUREMENT UNITS
RELATIVE UNITS
EM - relative to the font-size of the element (2em means 2 times the size of the current font)
REM - relative to font-size of the root element
% - Relative to parent size (percent)
STATIC UNITS
PX - pixels (1px = 1/96th of 1in)
MM - millimeters
CM - centimeters
PT - points (1pt = 1/72 of 1in)
PC - picas (1pc = 12 pt)
16
16
CSS – COLORS
RGB VALUES - rgb(221,117,0) / rgba(0,0,0,.5)
These express colors in terms of how much red, green and blue are used
to make it up.
HEX CODES - #dd7500
These are six-digit codes that represent the amount of red, green and blue
in a color, preceded by hash # sign.
COLOR NAMES - orange
These are 147 predefined color names that are recognized by browsers.
17
17
CSS – BOX MODEL
Any HTML element can be considered a BOX.
CONTENT could be text, images, etc.
WIDTH & HEIGHT are applied to the content area.
PADDINGS add extra space inside the border.
BORDERS surround the padding and content.
MARGINS add extra space outside the border.
18
18
CSS – BOX MODEL
FULL height element: border-top +
padding-top +
height +
padding-bottom +
border-bottom
19
19
CSS – BOX MODEL
FULL width element: border-right +
padding-right +
width +
padding-left +
border-left
20
20
CSS – BOX MODEL
BOX SIZING
.content {
box-sizing: content-box;
width: 400px;
padding: 10px;
}
Total width: 420px;
.box {
box-sizing: border-box;
width: 400px;
padding: 10px;
}
Total width: 400px;
21
21
CSS – POSITIONING ELEMENTS
{ position: static; } : the default position of all the elements. The top,
right, bottom, left and z-index properties do not apply.
{ position: relative; } : behaves the same as static but has top, right,
bottom, left and z-index properties enabled.
{ position: absolute; } : position the element at a specified position relative to
its closest positioned ancestor or to the containing block. It has top, right,
bottom, left and z-index properties enabled.
{ position: fixed; } : the element is positioned relative to the viewport, it
always stays in the same place even if the page is scrolled. It has top, right,
bottom, left and z-index properties enabled.
22
22
CSS – Z-INDEX
The z-index property specifies the stack order of an element.
An element with greater stack order is always in front of an element with
a lower stack order.
Works on positioned elements (position: absolute, position:
relative, or position: fixed)
Values can be positive or negative.
23
23
CSS – DISPLAY MODEL
Display property in CSS determines how that rectangular box behaves.
{ display : none; } : the element is still in the DOM, it is removed visually
{ display : inline; } : the element has no line break before or after it.
Accepts margins and padding but push the elements only horizontally. Height and
width are ignored
{ display : inline-block; } : similar to inline but the difference is that it
accepts width and height
{ display : block; } : forces a line break for the element. By default they take
up as much horizontal space as they can. Some elements have this property as
default.
24
24
CSS – LAYOUT
BLOCK ELEMENTS
Start on a new line
<h1> <p> <ul> <li> <form> <div> <header>
<footer> <section>
BOX
INLINE ELEMENTS
Flow in between surrounding text
<img> <span> <a>
BOX
BOX
BOX
BOX BOX
BOX
BOX
BOX
BOX
BOX
BOX
25
25
CSS – DISPLAY: FLEX
The flex CSS property sets how a flex item will grow or shrink to fit the space available in its flex container.
flex-direction - specifies the direction of the flexible
items inside the flex container.
FLEX CONTAINER
.container { display: flex; }
.container {
flex-direction: row | row-reverse |
column | column-reverse;
}
26
26
CSS – DISPLAY: FLEX
justify-content - aligns the flexible container's items when
the items do not use all available space on the main-axis.
.container {
justify-content: flex-start | flex-end | center |
space-between | space-around | space-evenly;
}
27
27
CSS – DISPLAY: FLEX
align-items - aligns the flexible container's items when the items do
not use all available space on the cross-axis.
.container {
align-items: flex-start | flex-end | center |
stretch | baseline;
}
28
28
CSS – DISPLAY: FLEX
align-content - aligns a flex container's lines within when there is
extra space in the cross-axis
.container {
align-content: flex-start | flex-end | center |
stretch | space-between | space-around;
}
29
29
CSS – DISPLAY: FLEX
FLEX ITEMS
.item {
order: <integer>;
flex-grow: <number>;
flex-basis: <length> | auto;
align-self: auto | flex-start | flex-end |
center | baseline | stretch;
}
30
30
CSS – FLOAT
float: none | left | right | initial | inherit;
You can float only block-level elements : <div>, <h1> - <h6>,
<p>, <form> etc.
The float CSS property specifies that an element should be placed
along the left or right side of its container, where text and inline
elements will wrap around it.
You can turn off a float using clear: left | right | both;
Left
25%
Right
25%
Dummy Text
50%
31
31
CSS – CALC()
USE 2:
.icon {
background-image: url("logo.png");
background-position: calc(100% - 25px) calc(100% - 25px);
}
The calc() CSS function lets you perform calculations when specifying CSS property values.
USE 1:
body {
width: calc(100% - 50px);
height: calc(85% + 25px);
}
32
32
CSS – MEDIA QUERIES
A media query consists of a media type and at least one expression that limits the style sheets' scope by
using media features, such as width, height, and color.
33
33
CSS – MEDIA QUERIES
Breakpoints allow the layout to change at
predefined points, i.e. having 3 columns on a
desktop, but only 1 column on a mobile
device.
Most CSS properties can be changed from
one breakpoint to another. Usually where you
put one depends on the content. If a sentence
breaks, you might need to add a breakpoint.
But use them with caution – it can get messy
quickly when it's difficult to understand what is
influencing what.
34
34
CSS – MEDIA QUERIES
/* Smartphones (portrait and landscape) */
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) */
@media only screen and (min-width : 321px) {
/* Styles */
}
/* Smartphones (portrait) */
@media only screen and (max-width : 320px) {
/* Styles */
}
35
35
Q&A?

Contenu connexe

Tendances (20)

Fundamental CSS3
Fundamental CSS3Fundamental CSS3
Fundamental CSS3
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
 
Css3 Presetation
Css3 PresetationCss3 Presetation
Css3 Presetation
 
CSS3
CSS3CSS3
CSS3
 
Cascading style sheets - CSS
Cascading style sheets - CSSCascading style sheets - CSS
Cascading style sheets - CSS
 
CSS and CSS3
CSS and CSS3CSS and CSS3
CSS and CSS3
 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing world
 
Web 102 INtro to CSS
Web 102  INtro to CSSWeb 102  INtro to CSS
Web 102 INtro to CSS
 
Sass
SassSass
Sass
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
 
CSS Part I
CSS Part ICSS Part I
CSS Part I
 
CSS3: Ripe and Ready to Respond
CSS3: Ripe and Ready to RespondCSS3: Ripe and Ready to Respond
CSS3: Ripe and Ready to Respond
 
Css 3
Css 3Css 3
Css 3
 
Css 3
Css 3Css 3
Css 3
 
CSS Cascade Style Sheet
CSS Cascade Style SheetCSS Cascade Style Sheet
CSS Cascade Style Sheet
 
Css
CssCss
Css
 
SASS Lecture
SASS Lecture SASS Lecture
SASS Lecture
 
CSS
CSSCSS
CSS
 
Css3
Css3Css3
Css3
 
CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)CSS_Day_Three (W3schools)
CSS_Day_Three (W3schools)
 

Similaire à CSS Walktrough Internship Course

Similaire à CSS Walktrough Internship Course (20)

Pfnp slides
Pfnp slidesPfnp slides
Pfnp slides
 
Css
CssCss
Css
 
CSS Foundations, pt 2
CSS Foundations, pt 2CSS Foundations, pt 2
CSS Foundations, pt 2
 
The Creative New World of CSS
The Creative New World of CSSThe Creative New World of CSS
The Creative New World of CSS
 
Css3
Css3Css3
Css3
 
Web Design Course: CSS lecture 4
Web Design Course: CSS  lecture 4Web Design Course: CSS  lecture 4
Web Design Course: CSS lecture 4
 
Confoo: You can use CSS for that!
Confoo: You can use CSS for that!Confoo: You can use CSS for that!
Confoo: You can use CSS for that!
 
GOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for thatGOTO Berlin - You can use CSS for that
GOTO Berlin - You can use CSS for that
 
CSS_Dibbo
CSS_DibboCSS_Dibbo
CSS_Dibbo
 
CSS - Basics
CSS - BasicsCSS - Basics
CSS - Basics
 
Intro to HTML and CSS basics
Intro to HTML and CSS basicsIntro to HTML and CSS basics
Intro to HTML and CSS basics
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
 
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
 
Next-level CSS
Next-level CSSNext-level CSS
Next-level CSS
 
Concept of CSS part 2
Concept of CSS part 2Concept of CSS part 2
Concept of CSS part 2
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
 
2_css.pptx
2_css.pptx2_css.pptx
2_css.pptx
 
Lecture-8.pptx
Lecture-8.pptxLecture-8.pptx
Lecture-8.pptx
 
WT CSS
WT  CSSWT  CSS
WT CSS
 

Plus de Zoltan Iszlai

Java Code Quality Improvements - DevWeek
Java Code Quality Improvements - DevWeekJava Code Quality Improvements - DevWeek
Java Code Quality Improvements - DevWeekZoltan Iszlai
 
Scrum Walkthrough Internship Course
Scrum Walkthrough Internship CourseScrum Walkthrough Internship Course
Scrum Walkthrough Internship CourseZoltan Iszlai
 
HTML Walkthrough Internship Course
HTML Walkthrough Internship CourseHTML Walkthrough Internship Course
HTML Walkthrough Internship CourseZoltan Iszlai
 
Java Study Group Report
Java Study Group ReportJava Study Group Report
Java Study Group ReportZoltan Iszlai
 
[Romanian] Git Branching Strategies
[Romanian] Git Branching Strategies[Romanian] Git Branching Strategies
[Romanian] Git Branching StrategiesZoltan Iszlai
 
Php Internship Course
Php Internship CoursePhp Internship Course
Php Internship CourseZoltan Iszlai
 
Using Scrum Internship Course
Using Scrum Internship CourseUsing Scrum Internship Course
Using Scrum Internship CourseZoltan Iszlai
 
Top 3 CMS Systems Compared
Top 3 CMS Systems ComparedTop 3 CMS Systems Compared
Top 3 CMS Systems ComparedZoltan Iszlai
 
Entity and NHibernate ORM Frameworks Compared
Entity and NHibernate ORM Frameworks ComparedEntity and NHibernate ORM Frameworks Compared
Entity and NHibernate ORM Frameworks ComparedZoltan Iszlai
 
[Hungarian] HTML Course - Sapientia University
[Hungarian] HTML Course - Sapientia University[Hungarian] HTML Course - Sapientia University
[Hungarian] HTML Course - Sapientia UniversityZoltan Iszlai
 
[Hungarian] CSS Course - Sapientia University
[Hungarian] CSS Course - Sapientia University[Hungarian] CSS Course - Sapientia University
[Hungarian] CSS Course - Sapientia UniversityZoltan Iszlai
 
[Hungarian] Scrum Course - Sapientia University
[Hungarian] Scrum Course - Sapientia University[Hungarian] Scrum Course - Sapientia University
[Hungarian] Scrum Course - Sapientia UniversityZoltan Iszlai
 
[Hungarian] Sysgenic Introduction - Sapientia University
[Hungarian] Sysgenic Introduction - Sapientia University[Hungarian] Sysgenic Introduction - Sapientia University
[Hungarian] Sysgenic Introduction - Sapientia UniversityZoltan Iszlai
 
User Centered Image Management System For Digital Libraries - DIAL 2006
User Centered Image Management System For Digital Libraries - DIAL 2006User Centered Image Management System For Digital Libraries - DIAL 2006
User Centered Image Management System For Digital Libraries - DIAL 2006Zoltan Iszlai
 
[Romanian] OOP and Design Patterns Internship Course
[Romanian] OOP and Design Patterns Internship Course[Romanian] OOP and Design Patterns Internship Course
[Romanian] OOP and Design Patterns Internship CourseZoltan Iszlai
 
[Romanian] HTML Internship Course
[Romanian] HTML Internship Course[Romanian] HTML Internship Course
[Romanian] HTML Internship CourseZoltan Iszlai
 

Plus de Zoltan Iszlai (16)

Java Code Quality Improvements - DevWeek
Java Code Quality Improvements - DevWeekJava Code Quality Improvements - DevWeek
Java Code Quality Improvements - DevWeek
 
Scrum Walkthrough Internship Course
Scrum Walkthrough Internship CourseScrum Walkthrough Internship Course
Scrum Walkthrough Internship Course
 
HTML Walkthrough Internship Course
HTML Walkthrough Internship CourseHTML Walkthrough Internship Course
HTML Walkthrough Internship Course
 
Java Study Group Report
Java Study Group ReportJava Study Group Report
Java Study Group Report
 
[Romanian] Git Branching Strategies
[Romanian] Git Branching Strategies[Romanian] Git Branching Strategies
[Romanian] Git Branching Strategies
 
Php Internship Course
Php Internship CoursePhp Internship Course
Php Internship Course
 
Using Scrum Internship Course
Using Scrum Internship CourseUsing Scrum Internship Course
Using Scrum Internship Course
 
Top 3 CMS Systems Compared
Top 3 CMS Systems ComparedTop 3 CMS Systems Compared
Top 3 CMS Systems Compared
 
Entity and NHibernate ORM Frameworks Compared
Entity and NHibernate ORM Frameworks ComparedEntity and NHibernate ORM Frameworks Compared
Entity and NHibernate ORM Frameworks Compared
 
[Hungarian] HTML Course - Sapientia University
[Hungarian] HTML Course - Sapientia University[Hungarian] HTML Course - Sapientia University
[Hungarian] HTML Course - Sapientia University
 
[Hungarian] CSS Course - Sapientia University
[Hungarian] CSS Course - Sapientia University[Hungarian] CSS Course - Sapientia University
[Hungarian] CSS Course - Sapientia University
 
[Hungarian] Scrum Course - Sapientia University
[Hungarian] Scrum Course - Sapientia University[Hungarian] Scrum Course - Sapientia University
[Hungarian] Scrum Course - Sapientia University
 
[Hungarian] Sysgenic Introduction - Sapientia University
[Hungarian] Sysgenic Introduction - Sapientia University[Hungarian] Sysgenic Introduction - Sapientia University
[Hungarian] Sysgenic Introduction - Sapientia University
 
User Centered Image Management System For Digital Libraries - DIAL 2006
User Centered Image Management System For Digital Libraries - DIAL 2006User Centered Image Management System For Digital Libraries - DIAL 2006
User Centered Image Management System For Digital Libraries - DIAL 2006
 
[Romanian] OOP and Design Patterns Internship Course
[Romanian] OOP and Design Patterns Internship Course[Romanian] OOP and Design Patterns Internship Course
[Romanian] OOP and Design Patterns Internship Course
 
[Romanian] HTML Internship Course
[Romanian] HTML Internship Course[Romanian] HTML Internship Course
[Romanian] HTML Internship Course
 

Dernier

What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 

Dernier (20)

What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

CSS Walktrough Internship Course

  • 2. 2 2 AGENDA ▪ CSS  WHAT IT IS  HOW TO INCLUDE CSS IN A PAGE  SELECTORS  SPECIFICITY  UNITS & COLORS  BOX MODEL  POSITIONING ELEMENTS  Z-INDEX  DISPLAY MODEL  DISPLAY FLEX  FLOAT  CALC()  MEDIA QUERIES
  • 3. 3 3 CSS – WHAT DOES IT MEAN Stands for Cascading Style Sheets. Defines how HTML elements are to be displayed in the browser. Cascading means that styles can fall (or cascade) from one style sheet to another, enabling multiple style sheets to be used on one HTML document.
  • 4. 4 4 INLINE STYLE <!DOCTYPE html> <html> <head> <title>Inline CSS</title> </head> <body> <div class="ninja" style="color: black;" > Black ninja </div> </body> </html> CSS – INLINE, INTERNAL, EXTERNAL
  • 5. 5 5 CSS – INLINE, INTERNAL, EXTERNAL INTERNAL CSS <!DOCTYPE html> <html> <head> <title>Inline CSS</title> <style type="text/css"> .ninja { color: black; } </style > </head> <body> <div class="ninja">Black ninja</div> </body> </html>
  • 6. 6 6 CSS – INLINE, INTERNAL, EXTERNAL EXTERNAL CSS <!DOCTYPE html> <html> <head> <title>Inline CSS</title> <link href="css/styles.css" type="text/css" rel="stylesheet" /> </head> <body> <div class="ninja">Black ninja</div> </body> </html>
  • 7. 7 7 CSS – ANATOMY OF A CSS SELECTOR CSS selectors allow to select and manipulate HTML elements.
  • 8. 8 8 CSS – SELECTOR TYPES TAG SELECTOR - matches element names. h1, p, div, span { display: block; } CLASS SELECTOR - selects elements which have a given class .box, div.box { background: blue; } ID SELECTOR - selects elements which have a given id #search { border: 1px solid black; } ATTRIBUTE - selects elements by their attributes [href] { cursor: pointer; }
  • 9. 9 9 CSS – SELECTOR TYPES GROUP - used to group together multiple selectors into one. p, a, .a-class-name { font-size: 18px; } DESCENDANTS - select elements that are descendants of other elements • they don’t have to be immediate children. div a { font-size: 18px; } • they have to be immediate children. div > a { font-size: 18px; }
  • 10. 10 10 CSS – PSEUDO CLASSES & ELEMENTS PSEUDO CLASS - is a keyword added to selectors that specifies a special state of the element to be selected: E.g.: active, focus, hover, link, visited, etc. a:hover { color: red; } PSEUDO ELEMENT - is a keyword added to selectors that allow to style certain parts of a document. E.g.: after, before, first-letter, first-line, etc. a:before { content: ">"; }
  • 11. 11 11 CSS – SPECIFICITY SPECIFICITY is the means by which browsers decide which CSS property values are the most relevant to an element and, therefore, will be applied. Specificity is based on the matching rules which are composed of different sorts of CSS selectors.
  • 13. 13 13 CSS – SPECIFICITY • Pseudo-elements (e.g. :before) get (0,0,0,1) unlike their pseudo-class (e.g. :hover) brethren which gets (0,0,1,0) • The !important value appended a CSS property value is an automatic win. It overrides even inline styles from the markup. The only way an !important value can be overridden is with another !important rule declared later in the CSS and with equal or great specificity value otherwise. You could think of it as adding (1,0,0,0,0) to the specificity value.
  • 14. 14 14 CSS – SPECIFICITY Example: <ul id="summer-drinks"> <li class="favorite">Whiskey and Ginger Ale</li> <li>Wheat Beer</li> <li>Mint Julip</li> </ul> ul#summer-drinks li { font-weight: normal; font-size: 12px; color: black; }
  • 15. 15 15 CSS – MEASUREMENT UNITS RELATIVE UNITS EM - relative to the font-size of the element (2em means 2 times the size of the current font) REM - relative to font-size of the root element % - Relative to parent size (percent) STATIC UNITS PX - pixels (1px = 1/96th of 1in) MM - millimeters CM - centimeters PT - points (1pt = 1/72 of 1in) PC - picas (1pc = 12 pt)
  • 16. 16 16 CSS – COLORS RGB VALUES - rgb(221,117,0) / rgba(0,0,0,.5) These express colors in terms of how much red, green and blue are used to make it up. HEX CODES - #dd7500 These are six-digit codes that represent the amount of red, green and blue in a color, preceded by hash # sign. COLOR NAMES - orange These are 147 predefined color names that are recognized by browsers.
  • 17. 17 17 CSS – BOX MODEL Any HTML element can be considered a BOX. CONTENT could be text, images, etc. WIDTH & HEIGHT are applied to the content area. PADDINGS add extra space inside the border. BORDERS surround the padding and content. MARGINS add extra space outside the border.
  • 18. 18 18 CSS – BOX MODEL FULL height element: border-top + padding-top + height + padding-bottom + border-bottom
  • 19. 19 19 CSS – BOX MODEL FULL width element: border-right + padding-right + width + padding-left + border-left
  • 20. 20 20 CSS – BOX MODEL BOX SIZING .content { box-sizing: content-box; width: 400px; padding: 10px; } Total width: 420px; .box { box-sizing: border-box; width: 400px; padding: 10px; } Total width: 400px;
  • 21. 21 21 CSS – POSITIONING ELEMENTS { position: static; } : the default position of all the elements. The top, right, bottom, left and z-index properties do not apply. { position: relative; } : behaves the same as static but has top, right, bottom, left and z-index properties enabled. { position: absolute; } : position the element at a specified position relative to its closest positioned ancestor or to the containing block. It has top, right, bottom, left and z-index properties enabled. { position: fixed; } : the element is positioned relative to the viewport, it always stays in the same place even if the page is scrolled. It has top, right, bottom, left and z-index properties enabled.
  • 22. 22 22 CSS – Z-INDEX The z-index property specifies the stack order of an element. An element with greater stack order is always in front of an element with a lower stack order. Works on positioned elements (position: absolute, position: relative, or position: fixed) Values can be positive or negative.
  • 23. 23 23 CSS – DISPLAY MODEL Display property in CSS determines how that rectangular box behaves. { display : none; } : the element is still in the DOM, it is removed visually { display : inline; } : the element has no line break before or after it. Accepts margins and padding but push the elements only horizontally. Height and width are ignored { display : inline-block; } : similar to inline but the difference is that it accepts width and height { display : block; } : forces a line break for the element. By default they take up as much horizontal space as they can. Some elements have this property as default.
  • 24. 24 24 CSS – LAYOUT BLOCK ELEMENTS Start on a new line <h1> <p> <ul> <li> <form> <div> <header> <footer> <section> BOX INLINE ELEMENTS Flow in between surrounding text <img> <span> <a> BOX BOX BOX BOX BOX BOX BOX BOX BOX BOX BOX
  • 25. 25 25 CSS – DISPLAY: FLEX The flex CSS property sets how a flex item will grow or shrink to fit the space available in its flex container. flex-direction - specifies the direction of the flexible items inside the flex container. FLEX CONTAINER .container { display: flex; } .container { flex-direction: row | row-reverse | column | column-reverse; }
  • 26. 26 26 CSS – DISPLAY: FLEX justify-content - aligns the flexible container's items when the items do not use all available space on the main-axis. .container { justify-content: flex-start | flex-end | center | space-between | space-around | space-evenly; }
  • 27. 27 27 CSS – DISPLAY: FLEX align-items - aligns the flexible container's items when the items do not use all available space on the cross-axis. .container { align-items: flex-start | flex-end | center | stretch | baseline; }
  • 28. 28 28 CSS – DISPLAY: FLEX align-content - aligns a flex container's lines within when there is extra space in the cross-axis .container { align-content: flex-start | flex-end | center | stretch | space-between | space-around; }
  • 29. 29 29 CSS – DISPLAY: FLEX FLEX ITEMS .item { order: <integer>; flex-grow: <number>; flex-basis: <length> | auto; align-self: auto | flex-start | flex-end | center | baseline | stretch; }
  • 30. 30 30 CSS – FLOAT float: none | left | right | initial | inherit; You can float only block-level elements : <div>, <h1> - <h6>, <p>, <form> etc. The float CSS property specifies that an element should be placed along the left or right side of its container, where text and inline elements will wrap around it. You can turn off a float using clear: left | right | both; Left 25% Right 25% Dummy Text 50%
  • 31. 31 31 CSS – CALC() USE 2: .icon { background-image: url("logo.png"); background-position: calc(100% - 25px) calc(100% - 25px); } The calc() CSS function lets you perform calculations when specifying CSS property values. USE 1: body { width: calc(100% - 50px); height: calc(85% + 25px); }
  • 32. 32 32 CSS – MEDIA QUERIES A media query consists of a media type and at least one expression that limits the style sheets' scope by using media features, such as width, height, and color.
  • 33. 33 33 CSS – MEDIA QUERIES Breakpoints allow the layout to change at predefined points, i.e. having 3 columns on a desktop, but only 1 column on a mobile device. Most CSS properties can be changed from one breakpoint to another. Usually where you put one depends on the content. If a sentence breaks, you might need to add a breakpoint. But use them with caution – it can get messy quickly when it's difficult to understand what is influencing what.
  • 34. 34 34 CSS – MEDIA QUERIES /* Smartphones (portrait and landscape) */ @media only screen and (min-device-width : 320px) and (max-device-width : 480px) { /* Styles */ } /* Smartphones (landscape) */ @media only screen and (min-width : 321px) { /* Styles */ } /* Smartphones (portrait) */ @media only screen and (max-width : 320px) { /* Styles */ }