SlideShare a Scribd company logo
1 of 16
CSS
Cascading Style Sheets
CSS in HTML PAGES
• In-Line
• Tag Style
<html>
<head>
<title>Example</title>
</head>
<body style="background-color: #FF0000;">
<p>This is a red page</p>
</body>
</html>
<html>
<head>
<title>Example</title>
<style type="text/css"> body {background-color: #FF0000;} </style>
</head>
<body>
<p>This is a red page</p>
</body>
</html>
CSS in HTML PAGES
• Link
Style.css:
<html>
<head>
<title>My document</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<p>This is a red page</p>
</body>
</html>
body {
background-color: #FF0000;
}
CSS Properties
body {
background-color: #FFCC66;
background-image: url("butterfly.gif");
background-repeat: no-repeat;
background-position: right bottom;
}
h1 {
background: #FFCC66 url("butterfly.gif") no-repeat right bottom;
}
p {
color: #990000;
font-style: italic;
font-weight: bold;
font-size: 30px;
font-family: arial, sans-serif;
}
h1 {
text-align: center;
}
p {
text-align: justify;
text-decoration: underline;
text-transform: uppercase;
}
CSS Selectors
Universal:
Type:
Class
* {
padding: 0;
margin: 0;
}
h1 {
font-size: 12px;
}
.header {
height: 200px;
}
<h1 class=“header”>This is text</h1>
CSS Selectors
Identification:
Attribute:
#header {
height: 200px;
}
<h1 id=“header”>This is text</h1>
input[type="submit"] {
background: #0f0;
}
<input type="submit" value=“Send to server"/>
<input type=“button" value=“Press me!"/>
input[type*="submit"] {
background: #0f0;
}
CSS PseudoClass
a:link {
color: blue;
}
a:visited {
color: red;
}
a:hover {
color: orange;
font-style: italic;
}
a:active {
color: green;
}
input:focus {
color: #aabbcc;
}
p:first-child {
color: grey;
}
CSS PseudoElement
h1:before {
content: “H1 tag open:";
color: red;
margin: 5px;
}
h1:after {
content: “:H1 tag close";
color: green;
margin: 5px;
}
CSS Selector Combination
Descendant selectors
p span {
color: #333;
}
<p>Черный текст <span>серый текст</span> черный текст </p>
<span>Черный текст</span>
<p>Черный текст <em>Черный текст <span>серый текст</span></em> черный текст</p>
#header .menu div {
text-align: center;
}
CSS Selector Combination
Child selectors
div > span {
color: #aaa;
}
<div>Этот текст будет черного цвета.
<span>А этот серого, ведь этот span — дочерний элемент для div.</span>
<p>Тут опять черный текст. <span>И этот текст тоже черный, так как этот span не дочерний
для div. Его непосредственный родитель — тег p.</span>
</p>
</div>
CSS Selector Combination
Adjacent sibling selectors
h1 + span {
font-weight: bold;
}
<h1>Very useful text</h1>
<span>This text is bold</span>
<p>Some other text</p>
<span>This text is NOT bold</span>
CSS Selector Combination
Grouping selector
h1, h2, h3 {
font-weight: bold;
}
div span, #header {
font-size: 12px
}
CSS Media types
Size
Type
div {
width: 300px;
}
@media all and (max-width: 1280px) {
div {
width: 200px;
}
}
div {
background-color: green;
}
@media print {
div {
background-color: white;
}
}
CSS Vendor prefixes
Chrome: -webkit-
Firefox: -moz-
Internet Explorer: -ms-
Opera: -o-
div {
-webkit-transition: all 4s ease;
-moz-transition: all 4s ease;
-ms-transition: all 4s ease;
-o-transition: all 4s ease;
transition: all 4s ease;
}
CSS Measurements
Unit Description Example
% Defines a measurement as a percentage relative to another value, typically an
enclosing element.
p {
font-size: 16pt;
line-height: 125%;}
cm Defines a measurement in centimeters. div {
margin-bottom: 2cm;}
em A relative measurement for the height of a font in em spaces. Because an em unit is
equivalent to the size of a given font, if you assign a font to 12pt, each "em" unit would
be 12pt; thus, 2em would be 24pt.
p {
letter-spacing: 7em;
}
ex This value defines a measurement relative to a font's x-height. The x-height is
determined by the height of the font's lowercase letter x.
p {
font-size: 24pt;
line-height: 3ex;
}
in Defines a measurement in inches. p {word-spacing: .15in;}
mm Defines a measurement in millimeters. p {
word-spacing: 15mm;}
pc Defines a measurement in picas. A pica is equivalent to 12 points; thus, there are 6
picas per inch.
p {
font-size: 20pc;
}
pt Defines a measurement in points. A point is defined as 1/72nd of an inch. body {
font-size: 18pt;}
px Defines a measurement in screen pixels. p {padding: 25px;}
CSS HomeTask
Text

More Related Content

What's hot

Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheetvijayta
 
Session on common html table
Session on common html tableSession on common html table
Session on common html tableRahul Kumar
 
Introduction to css & its attributes with syntax
Introduction to css & its attributes with syntaxIntroduction to css & its attributes with syntax
Introduction to css & its attributes with syntaxpriyadharshini murugan
 
Tables and forms with HTML, CSS
Tables and forms with HTML, CSS  Tables and forms with HTML, CSS
Tables and forms with HTML, CSS Yaowaluck Promdee
 
Cascading Style Sheets - CSS - Tutorial
Cascading Style Sheets - CSS  -  TutorialCascading Style Sheets - CSS  -  Tutorial
Cascading Style Sheets - CSS - TutorialMSA Technosoft
 
Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Gheyath M. Othman
 
Introduction to css part1
Introduction to css part1Introduction to css part1
Introduction to css part1Khem Puthea
 
Web Developement Workshop (Oct 2009 -Day 1)
Web Developement Workshop (Oct 2009 -Day 1)Web Developement Workshop (Oct 2009 -Day 1)
Web Developement Workshop (Oct 2009 -Day 1)Linux User's Group
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksAmit Tyagi
 
Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)AakankshaR
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to csseShikshak
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style SheetsSenthil Kumar
 
Web Design Course: CSS lecture 5
Web Design Course: CSS  lecture 5Web Design Course: CSS  lecture 5
Web Design Course: CSS lecture 5Gheyath M. Othman
 

What's hot (20)

CSS Font & Text style
CSS Font & Text style CSS Font & Text style
CSS Font & Text style
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 
Session on common html table
Session on common html tableSession on common html table
Session on common html table
 
Introduction to css & its attributes with syntax
Introduction to css & its attributes with syntaxIntroduction to css & its attributes with syntax
Introduction to css & its attributes with syntax
 
Tables and forms with HTML, CSS
Tables and forms with HTML, CSS  Tables and forms with HTML, CSS
Tables and forms with HTML, CSS
 
Cascading Style Sheets - CSS - Tutorial
Cascading Style Sheets - CSS  -  TutorialCascading Style Sheets - CSS  -  Tutorial
Cascading Style Sheets - CSS - Tutorial
 
Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1
 
Introduction to css part1
Introduction to css part1Introduction to css part1
Introduction to css part1
 
Web Developement Workshop (Oct 2009 -Day 1)
Web Developement Workshop (Oct 2009 -Day 1)Web Developement Workshop (Oct 2009 -Day 1)
Web Developement Workshop (Oct 2009 -Day 1)
 
How Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) WorksHow Cascading Style Sheets (CSS) Works
How Cascading Style Sheets (CSS) Works
 
CSS
CSSCSS
CSS
 
TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0TUTORIAL DE CSS 2.0
TUTORIAL DE CSS 2.0
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)Cascading Style Sheet (CSS)
Cascading Style Sheet (CSS)
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
 
Css starting
Css startingCss starting
Css starting
 
Introduction to css
Introduction to cssIntroduction to css
Introduction to css
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
 
Web Design Course: CSS lecture 5
Web Design Course: CSS  lecture 5Web Design Course: CSS  lecture 5
Web Design Course: CSS lecture 5
 
CSS ppt
CSS pptCSS ppt
CSS ppt
 

Similar to Css1 (20)

CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Css1
Css1Css1
Css1
 
CSS.pptx
CSS.pptxCSS.pptx
CSS.pptx
 
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.pptwaxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
 
css1.ppt
css1.pptcss1.ppt
css1.ppt
 
Css
CssCss
Css
 
Css
CssCss
Css
 
CSS notes
CSS notesCSS notes
CSS notes
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
 
html-css
html-csshtml-css
html-css
 
html
htmlhtml
html
 
Web Design Assignment 1
Web Design Assignment 1 Web Design Assignment 1
Web Design Assignment 1
 
CSS
CSSCSS
CSS
 
css-ppt.pdf
css-ppt.pdfcss-ppt.pdf
css-ppt.pdf
 
Lecture-6.pptx
Lecture-6.pptxLecture-6.pptx
Lecture-6.pptx
 
Turorial css
Turorial cssTurorial css
Turorial css
 
Introduction to css by programmerblog.net
Introduction to css by programmerblog.netIntroduction to css by programmerblog.net
Introduction to css by programmerblog.net
 
Web Engineering - Introduction to CSS
Web Engineering - Introduction to CSSWeb Engineering - Introduction to CSS
Web Engineering - Introduction to CSS
 
CSS Cascade Style Sheet
CSS Cascade Style SheetCSS Cascade Style Sheet
CSS Cascade Style Sheet
 
Css 1
Css 1Css 1
Css 1
 

Recently uploaded

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
 
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
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girlsstephieert
 
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
 
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
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGAPNIC
 
Radiant Call girls in Dubai O56338O268 Dubai Call girls
Radiant Call girls in Dubai O56338O268 Dubai Call girlsRadiant Call girls in Dubai O56338O268 Dubai Call girls
Radiant Call girls in Dubai O56338O268 Dubai Call girlsstephieert
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Roomdivyansh0kumar0
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
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
 
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
 
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
 
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
 
Gram Darshan PPT cyber rural in villages of india
Gram Darshan PPT cyber rural  in villages of indiaGram Darshan PPT cyber rural  in villages of india
Gram Darshan PPT cyber rural in villages of indiaimessage0108
 
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
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 

Recently uploaded (20)

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🔝
 
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
 
Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai 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 Pune
 
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
 
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
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 
Radiant Call girls in Dubai O56338O268 Dubai Call girls
Radiant Call girls in Dubai O56338O268 Dubai Call girlsRadiant Call girls in Dubai O56338O268 Dubai Call girls
Radiant Call girls in Dubai O56338O268 Dubai Call girls
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
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🔝
 
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
 
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
 
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
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
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
 
Gram Darshan PPT cyber rural in villages of india
Gram Darshan PPT cyber rural  in villages of indiaGram Darshan PPT cyber rural  in villages of india
Gram Darshan PPT cyber rural in villages of india
 
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
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 

Css1

  • 2. CSS in HTML PAGES • In-Line • Tag Style <html> <head> <title>Example</title> </head> <body style="background-color: #FF0000;"> <p>This is a red page</p> </body> </html> <html> <head> <title>Example</title> <style type="text/css"> body {background-color: #FF0000;} </style> </head> <body> <p>This is a red page</p> </body> </html>
  • 3. CSS in HTML PAGES • Link Style.css: <html> <head> <title>My document</title> <link rel="stylesheet" type="text/css" href="css/style.css" /> </head> <body> <p>This is a red page</p> </body> </html> body { background-color: #FF0000; }
  • 4. CSS Properties body { background-color: #FFCC66; background-image: url("butterfly.gif"); background-repeat: no-repeat; background-position: right bottom; } h1 { background: #FFCC66 url("butterfly.gif") no-repeat right bottom; } p { color: #990000; font-style: italic; font-weight: bold; font-size: 30px; font-family: arial, sans-serif; } h1 { text-align: center; } p { text-align: justify; text-decoration: underline; text-transform: uppercase; }
  • 5. CSS Selectors Universal: Type: Class * { padding: 0; margin: 0; } h1 { font-size: 12px; } .header { height: 200px; } <h1 class=“header”>This is text</h1>
  • 6. CSS Selectors Identification: Attribute: #header { height: 200px; } <h1 id=“header”>This is text</h1> input[type="submit"] { background: #0f0; } <input type="submit" value=“Send to server"/> <input type=“button" value=“Press me!"/> input[type*="submit"] { background: #0f0; }
  • 7. CSS PseudoClass a:link { color: blue; } a:visited { color: red; } a:hover { color: orange; font-style: italic; } a:active { color: green; } input:focus { color: #aabbcc; } p:first-child { color: grey; }
  • 8. CSS PseudoElement h1:before { content: “H1 tag open:"; color: red; margin: 5px; } h1:after { content: “:H1 tag close"; color: green; margin: 5px; }
  • 9. CSS Selector Combination Descendant selectors p span { color: #333; } <p>Черный текст <span>серый текст</span> черный текст </p> <span>Черный текст</span> <p>Черный текст <em>Черный текст <span>серый текст</span></em> черный текст</p> #header .menu div { text-align: center; }
  • 10. CSS Selector Combination Child selectors div > span { color: #aaa; } <div>Этот текст будет черного цвета. <span>А этот серого, ведь этот span — дочерний элемент для div.</span> <p>Тут опять черный текст. <span>И этот текст тоже черный, так как этот span не дочерний для div. Его непосредственный родитель — тег p.</span> </p> </div>
  • 11. CSS Selector Combination Adjacent sibling selectors h1 + span { font-weight: bold; } <h1>Very useful text</h1> <span>This text is bold</span> <p>Some other text</p> <span>This text is NOT bold</span>
  • 12. CSS Selector Combination Grouping selector h1, h2, h3 { font-weight: bold; } div span, #header { font-size: 12px }
  • 13. CSS Media types Size Type div { width: 300px; } @media all and (max-width: 1280px) { div { width: 200px; } } div { background-color: green; } @media print { div { background-color: white; } }
  • 14. CSS Vendor prefixes Chrome: -webkit- Firefox: -moz- Internet Explorer: -ms- Opera: -o- div { -webkit-transition: all 4s ease; -moz-transition: all 4s ease; -ms-transition: all 4s ease; -o-transition: all 4s ease; transition: all 4s ease; }
  • 15. CSS Measurements Unit Description Example % Defines a measurement as a percentage relative to another value, typically an enclosing element. p { font-size: 16pt; line-height: 125%;} cm Defines a measurement in centimeters. div { margin-bottom: 2cm;} em A relative measurement for the height of a font in em spaces. Because an em unit is equivalent to the size of a given font, if you assign a font to 12pt, each "em" unit would be 12pt; thus, 2em would be 24pt. p { letter-spacing: 7em; } ex This value defines a measurement relative to a font's x-height. The x-height is determined by the height of the font's lowercase letter x. p { font-size: 24pt; line-height: 3ex; } in Defines a measurement in inches. p {word-spacing: .15in;} mm Defines a measurement in millimeters. p { word-spacing: 15mm;} pc Defines a measurement in picas. A pica is equivalent to 12 points; thus, there are 6 picas per inch. p { font-size: 20pc; } pt Defines a measurement in points. A point is defined as 1/72nd of an inch. body { font-size: 18pt;} px Defines a measurement in screen pixels. p {padding: 25px;}