SlideShare a Scribd company logo
1 of 41
Why CSS ?
CSS Definitions
❖Cascading Style Sheets (CSS) are a stylesheet language used to describe the presentation
of a document written in HTML or XML (including XML dialects like SVG or XHTML).
❖CSS describes how elements should be displayed on screen, on paper, in speech, or on
other media. CSS is the only document styling language that browsers understand.​
❖CSS has a standardized W3C specification.​
❖CSS1 is now obsolete,​
❖CSS2.1 is a recommendation,​
❖CSS3 is split into smaller modules, progressing on the standardization track.​
The Basic Syntax of CSS
p{​
color : red;​
}​
p { color : red ; }
selector declaration
property value
The basic syntax of CSS
ORDER MATTERS COMMENTS IN CSS
P color will be lime
Adding styles to the page -external
styles
Adding styles to the page -internal
styles
Adding styles to the page -inline
styles
Importing Styles
CASCADING STYLE SHEETS
Cascading Style Sheets is a simple design language intended to simplify
the process of making web pages presentable.
Using CSS, you can control the color of the text, the style of fonts, the
spacing between paragraphs, how columns are sized and laid out, what
background images or colors are used, layout designs, variations in
display for different devices and screen sizes as well as a variety of other
effects.
TYPES OF CSS
• Inline CSS
•Internal CSS
•External CSS
Example: Inline CSS
<!DOCTYPE html>
<html>
<head>
<title> Inline CSS </title>
</head>
<body>
<h1> Introduction to CSS</h1>
<p style=“color:red”> Hello LPU</p>
<p style= “color:red”> Welcome to CSS</p>
<body>
</html>
Example: Internal CSS
<!DOCTYPE html>
<html>
<head>
<title> CSS Internal </title>
<style>
p
{
color:red;
}
h1
{
background-color:blue;
}
</style>
</head>
<body>
<h1> Introduction to CSS</h1>
<p > Hello LPU</p>
<p > Welcome to CSS</p>
</body>
</html>
Example: External CSS
<!DOCTYPE html>
<html>
<head>
<title> CSS External </title>
<link rel=“stylesheet” href=“b.css”>
</head>
<body>
<h1> Introduction to CSS</h1>
<p > Hello LPU</p>
<p > Welcome to CSS</p>
</body>
</html>
b.css
p
{
color:red;
}
h1
{
background-color:blue;
}
.
Example: Font Properties
<!DOCTYPE html>
<html>
<head>
<title> CSS Font Properties </title>
<link rel=“stylesheet” href=“b.css”>
</head>
<body>
<p > Welcome to CSS</p>
</body>
</html>
b.css
p
{
font-family:arial;
font-weight:bold;
font-style: italic;
font-size: 24px;
}
Example: Font Properties in One Line
<!DOCTYPE html>
<html>
<head>
<title> CSS Font Properties </title>
<link rel=“stylesheet” href=“b.css”>
</head>
<body>
<p > Welcome to CSS</p>
</body>
</html>
b.Css
p
{
font: bold italic 24px arial;
}
CSS Comments
p
{
font: bold italic 24px arial; /* weight style size family */
}
Example: Box Model-Padding
<!DOCTYPE html>
<html>
<head>
<title> CSS -Padding </title>
<link rel=“stylesheet” href=“b.css”>
</head>
<body>
<p > Welcome to CSS</p>
</body>
</html>
b.css
p
{
background-color:blue;
padding-top: 30px;
padding-bottom: 30px;
padding-left: 50px;
padding-right: 50px;
}
/* top right bottom left*/
Example: Box Model-Borders
<!DOCTYPE html>
<html>
<head>
<title> CSS -Borders </title>
<link rel=“stylesheet” href=“b.css”>
</head>
<body>
<p > Welcome to CSS</p>
</body>
</html>
b.css
p
{
background-color:blue;
padding: 30px;
border-style:solid;
border-width:10px;
border-color: green;
}
border: 5px ridge red;
Example: Box Model-Margin
<!DOCTYPE html>
<html>
<head>
<title> CSS -Margin </title>
<link rel=“stylesheet” href=“b.css”>
</head>
<body>
<p > Welcome to CSS</p>
</body>
</html>
b.css
p
{
background-color:blue;
margin-top: 30px;
margin-bottom: 30px;
margin-left: 50px;
margin-right: 50px;
}
Example: Background Images
<!DOCTYPE html>
<html>
<head>
<title> CSS –Background Images</title>
<link rel=“stylesheet” href=“b.css”>
</head>
<body>
<div>
Hello LPU
</div>
</body>
</html>
b.css
div
{
height:200px;
width: 100%;
background-image:url(a.jpg);
background-repeat: repeat-x;
background-position:center top;
}
Example: Child Selectors
<!DOCTYPE html>
<html>
<head>
<title> CSS –Child Selectors</title>
<link rel=“stylesheet” href=“b.css”>
</head>
<body>
<div>
<p> Hello LPU</p>
</div>
<p> Welcome to LPU</p>
</body>
</html>
div p
{
color:red;
}
P
{
color:yellow;
}
Example: Child Selectors
<!DOCTYPE html>
<html>
<head>
<title> CSS –Child Selectors</title>
<link rel=“stylesheet” href=“b.css”>
</head>
<body>
<div class=“abc”>
<p> Hello LPU</p>
</div>
<div class=“def”>
<p> Welcome to LPU</p>
</div>
</body>
</html>
.abc p
{
color:red;
}
.def p
{
color:yellow;
}
Specify media type: @import
Media type using media queries
Media type in HTML “media”
attribute
Basic Selectors
❖ ID
Selects the element with id="firstname"
❖ Class
Selects all elements with class="intro"
❖ Type
Selects all <p> elements
❖ Universal
Selects all elements
Combinators
Groups of selectors
A comma-separated list of selectors represents the union of all elements
selected by each of the individual selectors in the list
Descendant combinator
Selects all <p> elements inside <div> elements
Child combinator
Selects all <p> elements where the parent is a <div> element
Adjacent sibling combinator
Selects all <p> elements that are placed immediately after <div>
elements
General sibling combinator
Selects every <ul> element that are preceded by a <p> element
div , p
div p
div > p
div + p
p ~ ul
div > p
div + p
Pseudo-classes
The pseudo-class concept is introduced to
permit selection based on information that lies
outside of the document tree or that cannot be
expressed using the other simple selectors.
Dynamic Pseudo-classes
Link
User Action
(Some) structural pseudo-classes
Pseudo-elements
Pseudo-elements
!important
!important declaration overrides any other
CSS
declaration.
selector {
property: property value !important;
}
!important usage
You can use !important (it is not an anti-pattern), when
your goal is that the property should not be overridden.
Never use !important to override other rules!
Do use selectors with proper specificity to achieve that.
CSS Specificity
CSS Specificity
Specificity Calculator
Specificity Calculator :
https://specificity.keegan.st/
Games- Practising….
https://flukeout.github.io/ - ...selectors
https://flexboxfroggy.com/ - ...flexbox
https://cssgridgarden.com/ - ...css grid
CSS1.pptx

More Related Content

Similar to CSS1.pptx (20)

Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 
INTRODUCTIONS OF CSS
INTRODUCTIONS OF CSSINTRODUCTIONS OF CSS
INTRODUCTIONS OF CSS
 
Introduction HTML and CSS
Introduction HTML and CSSIntroduction HTML and CSS
Introduction HTML and CSS
 
Webpage style with CSS
Webpage style with CSSWebpage style with CSS
Webpage style with CSS
 
Html html html html html html html html html
Html html html html html html html html htmlHtml html html html html html html html html
Html html html html html html html html html
 
Css
CssCss
Css
 
Fwd week2 tw-20120903
Fwd week2 tw-20120903Fwd week2 tw-20120903
Fwd week2 tw-20120903
 
Web Development Using CSS3
Web Development Using CSS3Web Development Using CSS3
Web Development Using CSS3
 
Web Development Using CSS3
Web Development Using CSS3Web Development Using CSS3
Web Development Using CSS3
 
Css1
Css1Css1
Css1
 
Css ms megha
Css ms meghaCss ms megha
Css ms megha
 
Workshop 2 Slides.pptx
Workshop 2 Slides.pptxWorkshop 2 Slides.pptx
Workshop 2 Slides.pptx
 
Web Designing
Web DesigningWeb Designing
Web Designing
 
LIS3353 SP12 Week 13
LIS3353 SP12 Week 13LIS3353 SP12 Week 13
LIS3353 SP12 Week 13
 
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...
 
Html 2
Html   2Html   2
Html 2
 
Css starting
Css startingCss starting
Css starting
 
Introduction to CSS.pptx
Introduction to CSS.pptxIntroduction to CSS.pptx
Introduction to CSS.pptx
 
WT CSS
WT  CSSWT  CSS
WT CSS
 
Web technology Unit-II Part-C
Web technology Unit-II Part-CWeb technology Unit-II Part-C
Web technology Unit-II Part-C
 

Recently uploaded

AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadhamedmustafa094
 
Rums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfRums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfsmsksolar
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stageAbc194748
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"mphochane1998
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesRAJNEESHKUMAR341697
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...soginsider
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projectssmsksolar
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 

Recently uploaded (20)

AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
Rums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfRums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdf
 
Air Compressor reciprocating single stage
Air Compressor reciprocating single stageAir Compressor reciprocating single stage
Air Compressor reciprocating single stage
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 

CSS1.pptx

  • 2. CSS Definitions ❖Cascading Style Sheets (CSS) are a stylesheet language used to describe the presentation of a document written in HTML or XML (including XML dialects like SVG or XHTML). ❖CSS describes how elements should be displayed on screen, on paper, in speech, or on other media. CSS is the only document styling language that browsers understand.​ ❖CSS has a standardized W3C specification.​ ❖CSS1 is now obsolete,​ ❖CSS2.1 is a recommendation,​ ❖CSS3 is split into smaller modules, progressing on the standardization track.​
  • 3. The Basic Syntax of CSS p{​ color : red;​ }​ p { color : red ; } selector declaration property value
  • 4. The basic syntax of CSS ORDER MATTERS COMMENTS IN CSS P color will be lime
  • 5. Adding styles to the page -external styles
  • 6. Adding styles to the page -internal styles
  • 7. Adding styles to the page -inline styles
  • 9. CASCADING STYLE SHEETS Cascading Style Sheets is a simple design language intended to simplify the process of making web pages presentable. Using CSS, you can control the color of the text, the style of fonts, the spacing between paragraphs, how columns are sized and laid out, what background images or colors are used, layout designs, variations in display for different devices and screen sizes as well as a variety of other effects. TYPES OF CSS • Inline CSS •Internal CSS •External CSS
  • 10. Example: Inline CSS <!DOCTYPE html> <html> <head> <title> Inline CSS </title> </head> <body> <h1> Introduction to CSS</h1> <p style=“color:red”> Hello LPU</p> <p style= “color:red”> Welcome to CSS</p> <body> </html>
  • 11. Example: Internal CSS <!DOCTYPE html> <html> <head> <title> CSS Internal </title> <style> p { color:red; } h1 { background-color:blue; } </style> </head> <body> <h1> Introduction to CSS</h1> <p > Hello LPU</p> <p > Welcome to CSS</p> </body> </html>
  • 12. Example: External CSS <!DOCTYPE html> <html> <head> <title> CSS External </title> <link rel=“stylesheet” href=“b.css”> </head> <body> <h1> Introduction to CSS</h1> <p > Hello LPU</p> <p > Welcome to CSS</p> </body> </html> b.css p { color:red; } h1 { background-color:blue; }
  • 13. . Example: Font Properties <!DOCTYPE html> <html> <head> <title> CSS Font Properties </title> <link rel=“stylesheet” href=“b.css”> </head> <body> <p > Welcome to CSS</p> </body> </html> b.css p { font-family:arial; font-weight:bold; font-style: italic; font-size: 24px; }
  • 14. Example: Font Properties in One Line <!DOCTYPE html> <html> <head> <title> CSS Font Properties </title> <link rel=“stylesheet” href=“b.css”> </head> <body> <p > Welcome to CSS</p> </body> </html> b.Css p { font: bold italic 24px arial; }
  • 15. CSS Comments p { font: bold italic 24px arial; /* weight style size family */ }
  • 16. Example: Box Model-Padding <!DOCTYPE html> <html> <head> <title> CSS -Padding </title> <link rel=“stylesheet” href=“b.css”> </head> <body> <p > Welcome to CSS</p> </body> </html> b.css p { background-color:blue; padding-top: 30px; padding-bottom: 30px; padding-left: 50px; padding-right: 50px; } /* top right bottom left*/
  • 17. Example: Box Model-Borders <!DOCTYPE html> <html> <head> <title> CSS -Borders </title> <link rel=“stylesheet” href=“b.css”> </head> <body> <p > Welcome to CSS</p> </body> </html> b.css p { background-color:blue; padding: 30px; border-style:solid; border-width:10px; border-color: green; } border: 5px ridge red;
  • 18. Example: Box Model-Margin <!DOCTYPE html> <html> <head> <title> CSS -Margin </title> <link rel=“stylesheet” href=“b.css”> </head> <body> <p > Welcome to CSS</p> </body> </html> b.css p { background-color:blue; margin-top: 30px; margin-bottom: 30px; margin-left: 50px; margin-right: 50px; }
  • 19. Example: Background Images <!DOCTYPE html> <html> <head> <title> CSS –Background Images</title> <link rel=“stylesheet” href=“b.css”> </head> <body> <div> Hello LPU </div> </body> </html>
  • 21. Example: Child Selectors <!DOCTYPE html> <html> <head> <title> CSS –Child Selectors</title> <link rel=“stylesheet” href=“b.css”> </head> <body> <div> <p> Hello LPU</p> </div> <p> Welcome to LPU</p> </body> </html> div p { color:red; } P { color:yellow; }
  • 22. Example: Child Selectors <!DOCTYPE html> <html> <head> <title> CSS –Child Selectors</title> <link rel=“stylesheet” href=“b.css”> </head> <body> <div class=“abc”> <p> Hello LPU</p> </div> <div class=“def”> <p> Welcome to LPU</p> </div> </body> </html>
  • 24.
  • 26. Media type using media queries
  • 27. Media type in HTML “media” attribute
  • 28. Basic Selectors ❖ ID Selects the element with id="firstname" ❖ Class Selects all elements with class="intro" ❖ Type Selects all <p> elements ❖ Universal Selects all elements
  • 29. Combinators Groups of selectors A comma-separated list of selectors represents the union of all elements selected by each of the individual selectors in the list Descendant combinator Selects all <p> elements inside <div> elements Child combinator Selects all <p> elements where the parent is a <div> element Adjacent sibling combinator Selects all <p> elements that are placed immediately after <div> elements General sibling combinator Selects every <ul> element that are preceded by a <p> element div , p div p div > p div + p p ~ ul div > p div + p
  • 30. Pseudo-classes The pseudo-class concept is introduced to permit selection based on information that lies outside of the document tree or that cannot be expressed using the other simple selectors.
  • 35. !important !important declaration overrides any other CSS declaration. selector { property: property value !important; }
  • 36. !important usage You can use !important (it is not an anti-pattern), when your goal is that the property should not be overridden. Never use !important to override other rules! Do use selectors with proper specificity to achieve that.
  • 39. Specificity Calculator Specificity Calculator : https://specificity.keegan.st/
  • 40. Games- Practising…. https://flukeout.github.io/ - ...selectors https://flexboxfroggy.com/ - ...flexbox https://cssgridgarden.com/ - ...css grid