SlideShare a Scribd company logo
IN A ROCKET
Learn front-end development at rocket speed
CSS CSS FUNDAMENTALS
SelectorsAttribute
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
ATTRIBUTE
PRESENCE 

AND VALUE
SELECTORS
SUBSTRING
MATCHING
ATTRIBUTE
SELECTORS
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Attribute presence 

and value selectors
[attribute]
[attribute=value]

[attribute~=value]

[attribute|=value]
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
ATTRIBUTE SELECTOR
With this code all elements with the target attribute are shown in green.
Selects all elements with a specific attribute.
[target] {color: green}
Syntax [attribute] {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
ATTRIBUTE SELECTOR
<body>
<a href="#" target="_blank">First link.</a>
<a href="#">Second link.</a>
</body>
[target] { color: green; }
Web page title
index.html
First link.
Second link.
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Attribute presence 

and value selectors
[attribute]

[attribute=value]
[attribute~=value]

[attribute|=value]
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
ATTRIBUTE SELECTOR
With this code all elements with the attribute target and the value _blank are shown in green.
Selects all elements with a specific attribute and value.
[target=_blank] {color: green}
Syntax [attribute=value] {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
ATTRIBUTE SELECTOR
<body>
<a href="#" target="_blank">First link.</a><br>
<a href="#" target="_top">Second link.</a><br>
<a href="http://wikipedia.org">Wikipedia.</a><br>
<img src="world.png" alt="World">
</body>
[target=_blank] { color: red; }
[href=http://wikipedia.org] { color: green; }
[src=world.png] { background: green; }
Web page title
index.html
First link.
Second link.
Wikipedia.
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
ATTRIBUTE SELECTOR
<body>
<form>
Name: <input type="text">
<input type="submit" value="Send">
</form>
</body>
[type=submit] { background: red; }
Web page title
index.html
Name:
Send
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Attribute presence 

and value selectors
[attribute]

[attribute=value]

[attribute~=value]
[attribute|=value]
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
ATTRIBUTE SELECTOR
With this code all elements with the attribute target and the value deal are shown in green.
Selects all elements with a specific attribute, but only if the value is one of a space-separated list of
words.
[data-item~=deal] {color: green}
Syntax [attribute~=value] {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
ATTRIBUTE SELECTOR
<body>
<article data-item="food deal choco">
<h2>Best chocolate ever!</h2>
<p>Product info.</p>
</article>
<article data-item="food choco">
<h2>Just white chocolate</h2>
<p>Product info.</p>
</article>
</body>
[data-item~=deal] { color: green; }
Web page title
index.html
Best chocolate ever!
Product info.
Just white chocolate
Product info.
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Attribute presence 

and value selectors
[attribute]

[attribute=value]

[attribute~=value]

[attribute|=value]
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
ATTRIBUTE SELECTOR
With this code all elements with the hreflang attribute and 

its value beginning with en are shown in green.
Selects all elements with a specific attribute if their value is exactly a particular text or begins with it.
[hreflang|=en] {color: green}
Syntax [attribute|=value] {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
ATTRIBUTE SELECTOR
<body>
<a href="#" hreflang="en">Wikipedia English</a><br>
<a href="#" hreflang="en-us">Wikipedia US</a><br>
<a href="#" hreflang="en-gb">Wikipedia UK</a><br>
<a href="#" hreflang="fr">Wikipedia France</a>
</body>
[hreflang|=en] { color: green; }
Web page title
index.html
Wikipedia English
Wikipedia US

Wikipedia UK

Wikipedia France
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
ATTRIBUTE
PRESENCE 

AND VALUE
SELECTORS
SUBSTRING
MATCHING
ATTRIBUTE
SELECTORS
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Substring matching 

attribute selectors
[attribute^=value]

[attribute*=value]

[attribute$=value]
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
value
^Begins with
*Contains
$
Ends with
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Substring matching 

attribute selectors
[attribute^=value]
[attribute*=value]

[attribute$=value]
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
ATTRIBUTE SELECTOR
With this code all elements with the data-item attribute and 

its value beginning with food are shown in green.
Selects all elements with a specific attribute if their value begins with a particular text.
[data-item^=food] {color: green}
Syntax [attribute^=value] {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
ATTRIBUTE SELECTOR
<body>
<article data-item="food choco black">
<h2>Best chocolate ever!</h2>
<p>Product info.</p>
</article>
<article data-item="choco food white">
<h2>Just white chocolate</h2>
<p>Product info.</p>
</article>
</body>
[data-item^=food] { color: green; }
Web page title
index.html
Best chocolate ever!
Product info.
Just white chocolate
Product info.
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Substring matching 

attribute selectors
[attribute^=value]

[attribute*=value]
[attribute$=value]
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
ATTRIBUTE SELECTOR
With this code all elements with the data-item attribute and 

its value containing food are shown in green.
Selects all elements with a specific attribute if their value contains a particular text.
[data-item*=food] {color: green}
Syntax [attribute*=value] {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
ATTRIBUTE SELECTOR
<body>
<article data-item="choco food black">
<h2>Best chocolate ever!</h2>
<p>Product info.</p>
</article>
<article data-item="choco white food">
<h2>Just white chocolate</h2>
<p>Product info.</p>
</article>
</body>
[data-item*=food] { color: green; }
Web page title
index.html
Best chocolate ever!
Product info.
Just white chocolate
Product info.
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
Substring matching 

attribute selectors
[attribute^=value]

[attribute*=value]

[attribute$=value]
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
ATTRIBUTE SELECTOR
With this code all elements with the data-item attribute and 

its value ending with food are shown in green.
Selects all elements with a specific attribute if their value ends with a particular text.
[data-item$=food] {color: green}
Syntax [attribute$=value] {style properties}
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
HTML CSS
Browser
ATTRIBUTE SELECTOR
<body>
<article data-item="choco food black">
<h2>Best chocolate ever!</h2>
<p>Product info.</p>
</article>
<article data-item="choco white food">
<h2>Just white chocolate</h2>
<p>Product info.</p>
</article>
</body>
[data-item$=food] { color: green; }
Web page title
index.html
Best chocolate ever!
Product info.
Just white chocolate
Product info.
READY TO USE CODE
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
ATTRIBUTE
PRESENCE 

AND VALUE
SELECTORS
SUBSTRING
MATCHING
ATTRIBUTE
SELECTORS
CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com
REFERENCE: W3C
SOURCE: Selectors Level 3 by W3C.
Learn front-end development at rocket speed
inarocket.com
by miguelsanchez.com
YOU CAN CONTINUE THIS COURSE FOR FREE ON
+ READY TO USE CODE
+ QUIZZES
+ FREE UPDATES
We respect your time

No more blah blah videos. Just straight to
the point slides with relevant information.
Ready to use code

Real code you can just copy and paste into
your real projects.
Step by step guides

Clear and concise steps to build real use
solutions. No missed points.
Learn front-end development at rocket speed
inarocket.com
IN A ROCKET
Learn front-end development at rocket speed
CSS CSS FUNDAMENTALS
SelectorsAttribute

More Related Content

Similar to 8- Learn CSS Fundamentals / Attribute selectors (20)

PPTX
Id and class selector
MyCredentials YourReference
 
PDF
Learn SUIT: CSS Naming Convention
In a Rocket
 
PDF
lec 5 Introduction to CSS uyuhijoljihugfcufgy
kanwalhina636
 
PPTX
CSS
Akila Iroshan
 
PDF
13- Learn CSS Fundamentals / Specificity
In a Rocket
 
PDF
Html / CSS Presentation
Shawn Calvert
 
ODP
An Introduction to Cascading Style Sheets (CSS3)
Ardee Aram
 
PPT
Pres
Andrey L
 
ODP
Cascading Style Sheets
Shivasubramanian Ananthanarayanan
 
PPT
Css week10 2019 2020 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
DOCX
Introducing CSS Selectors.docx
Dr. Somnath Sinha
 
PDF
CSS Foundations, pt 1
Shawn Calvert
 
PPTX
Web 102 INtro to CSS
Hawkman Academy
 
PPTX
Fundamental of Web Development Tutorials-CSS by PINFO Technologies.pptx
umoren
 
PDF
Web Design Course: CSS lecture 1
Gheyath M. Othman
 
PPT
Cascading Style Sheets
M Vishnuvardhan Reddy
 
PDF
HTML News Packages Lesson
UC Berkeley Graduate School of Journalism
 
PDF
Basic-CSS-tutorial
tutorialsruby
 
PDF
Basic-CSS-tutorial
tutorialsruby
 
PDF
Basic css-tutorial
mohamed ashraf
 
Id and class selector
MyCredentials YourReference
 
Learn SUIT: CSS Naming Convention
In a Rocket
 
lec 5 Introduction to CSS uyuhijoljihugfcufgy
kanwalhina636
 
13- Learn CSS Fundamentals / Specificity
In a Rocket
 
Html / CSS Presentation
Shawn Calvert
 
An Introduction to Cascading Style Sheets (CSS3)
Ardee Aram
 
Pres
Andrey L
 
Cascading Style Sheets
Shivasubramanian Ananthanarayanan
 
Css week10 2019 2020 for g10 by eng.osama ghandour
Osama Ghandour Geris
 
Introducing CSS Selectors.docx
Dr. Somnath Sinha
 
CSS Foundations, pt 1
Shawn Calvert
 
Web 102 INtro to CSS
Hawkman Academy
 
Fundamental of Web Development Tutorials-CSS by PINFO Technologies.pptx
umoren
 
Web Design Course: CSS lecture 1
Gheyath M. Othman
 
Cascading Style Sheets
M Vishnuvardhan Reddy
 
Basic-CSS-tutorial
tutorialsruby
 
Basic-CSS-tutorial
tutorialsruby
 
Basic css-tutorial
mohamed ashraf
 

More from In a Rocket (11)

PDF
3- Learn Flexbox & CSS Grid / Container & items
In a Rocket
 
PDF
2- Learn Flexbox & CSS Grid / Context
In a Rocket
 
PDF
1- Learn Flexbox & CSS Grid / Environment setup
In a Rocket
 
PDF
17- Learn CSS Fundamentals / Units
In a Rocket
 
PDF
16- Learn CSS Fundamentals / Background
In a Rocket
 
PDF
15- Learn CSS Fundamentals / Color
In a Rocket
 
PDF
14- Learn CSS Fundamentals / Inheritance
In a Rocket
 
PDF
10- Learn CSS Fundamentals / Pseudo-elements
In a Rocket
 
PDF
2- Learn HTML Fundamentals / Text Formatting
In a Rocket
 
PDF
1- Learn HTML Fundamentals / Start in 5 Minutes
In a Rocket
 
PDF
Learn BEM: CSS Naming Convention
In a Rocket
 
3- Learn Flexbox & CSS Grid / Container & items
In a Rocket
 
2- Learn Flexbox & CSS Grid / Context
In a Rocket
 
1- Learn Flexbox & CSS Grid / Environment setup
In a Rocket
 
17- Learn CSS Fundamentals / Units
In a Rocket
 
16- Learn CSS Fundamentals / Background
In a Rocket
 
15- Learn CSS Fundamentals / Color
In a Rocket
 
14- Learn CSS Fundamentals / Inheritance
In a Rocket
 
10- Learn CSS Fundamentals / Pseudo-elements
In a Rocket
 
2- Learn HTML Fundamentals / Text Formatting
In a Rocket
 
1- Learn HTML Fundamentals / Start in 5 Minutes
In a Rocket
 
Learn BEM: CSS Naming Convention
In a Rocket
 
Ad

Recently uploaded (20)

PDF
web application development company in bangalore.pdf
https://dkpractice.co.in/seo.html tech
 
PDF
BroadLink Cloud Service introduction.pdf
DevendraDwivdi1
 
PPTX
Lesson 1.1 Career-Opportunities-in-Ict.pptx
lizelgumadlas1
 
PPTX
原版一样(ANU毕业证书)澳洲澳大利亚国立大学毕业证在线购买
Taqyea
 
PDF
Slides: Eco Economic Epochs for The World Game (s) pdf
Steven McGee
 
PPT
Almos Entirely Correct Mixing with Apps to Voting
gapati2964
 
PDF
The Convergence of Threat Behaviors Across Intrusions
Joe Slowik
 
PDF
ContextForge MCP Gateway - the missing proxy for AI Agents and Tools
Mihai Criveti
 
PDF
Clive Dickens RedTech Public Copy - Collaborate or Die
Clive Dickens
 
PDF
I Want to join occult brotherhood for money ritual#((+2347089754903))
haragonoccult
 
PDF
Transmission Control Protocol (TCP) and Starlink
APNIC
 
PPTX
BitRecover OST to PST Converter Software
antoniogosling01
 
PPTX
Q1 English3 Week5 [email protected]
JenniferCawaling1
 
PDF
B M Mostofa Kamal Al-Azad [Document & Localization Expert]
Mostofa Kamal Al-Azad
 
PPTX
Class_4_Limbgvchgchgchgchgchgcjhgchgcnked_Lists.pptx
test123n
 
PPTX
原版一样(ISM毕业证书)德国多特蒙德国际管理学院毕业证多少钱
taqyed
 
PDF
Materi tentang From Digital Economy to Fintech.pdf
Abdul Hakim
 
PPTX
The ARUBA Kind of new Proposal Umum .pptx
andiwarneri
 
PPTX
My Mother At 66! (2).pptx00000000000000000000000000000
vedapattisiddharth
 
PDF
03 Internal Analysis Strategik Manajemen.pdf
AhmadRifaldhi
 
web application development company in bangalore.pdf
https://dkpractice.co.in/seo.html tech
 
BroadLink Cloud Service introduction.pdf
DevendraDwivdi1
 
Lesson 1.1 Career-Opportunities-in-Ict.pptx
lizelgumadlas1
 
原版一样(ANU毕业证书)澳洲澳大利亚国立大学毕业证在线购买
Taqyea
 
Slides: Eco Economic Epochs for The World Game (s) pdf
Steven McGee
 
Almos Entirely Correct Mixing with Apps to Voting
gapati2964
 
The Convergence of Threat Behaviors Across Intrusions
Joe Slowik
 
ContextForge MCP Gateway - the missing proxy for AI Agents and Tools
Mihai Criveti
 
Clive Dickens RedTech Public Copy - Collaborate or Die
Clive Dickens
 
I Want to join occult brotherhood for money ritual#((+2347089754903))
haragonoccult
 
Transmission Control Protocol (TCP) and Starlink
APNIC
 
BitRecover OST to PST Converter Software
antoniogosling01
 
B M Mostofa Kamal Al-Azad [Document & Localization Expert]
Mostofa Kamal Al-Azad
 
Class_4_Limbgvchgchgchgchgchgcjhgchgcnked_Lists.pptx
test123n
 
原版一样(ISM毕业证书)德国多特蒙德国际管理学院毕业证多少钱
taqyed
 
Materi tentang From Digital Economy to Fintech.pdf
Abdul Hakim
 
The ARUBA Kind of new Proposal Umum .pptx
andiwarneri
 
My Mother At 66! (2).pptx00000000000000000000000000000
vedapattisiddharth
 
03 Internal Analysis Strategik Manajemen.pdf
AhmadRifaldhi
 
Ad

8- Learn CSS Fundamentals / Attribute selectors

  • 1. IN A ROCKET Learn front-end development at rocket speed CSS CSS FUNDAMENTALS SelectorsAttribute
  • 2. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com ATTRIBUTE PRESENCE 
 AND VALUE SELECTORS SUBSTRING MATCHING ATTRIBUTE SELECTORS
  • 3. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Attribute presence 
 and value selectors [attribute] [attribute=value] [attribute~=value] [attribute|=value]
  • 4. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com ATTRIBUTE SELECTOR With this code all elements with the target attribute are shown in green. Selects all elements with a specific attribute. [target] {color: green} Syntax [attribute] {style properties}
  • 5. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser ATTRIBUTE SELECTOR <body> <a href="#" target="_blank">First link.</a> <a href="#">Second link.</a> </body> [target] { color: green; } Web page title index.html First link. Second link. READY TO USE CODE
  • 6. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Attribute presence 
 and value selectors [attribute] [attribute=value] [attribute~=value] [attribute|=value]
  • 7. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com ATTRIBUTE SELECTOR With this code all elements with the attribute target and the value _blank are shown in green. Selects all elements with a specific attribute and value. [target=_blank] {color: green} Syntax [attribute=value] {style properties}
  • 8. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser ATTRIBUTE SELECTOR <body> <a href="#" target="_blank">First link.</a><br> <a href="#" target="_top">Second link.</a><br> <a href="http://wikipedia.org">Wikipedia.</a><br> <img src="world.png" alt="World"> </body> [target=_blank] { color: red; } [href=http://wikipedia.org] { color: green; } [src=world.png] { background: green; } Web page title index.html First link. Second link. Wikipedia. READY TO USE CODE
  • 9. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser ATTRIBUTE SELECTOR <body> <form> Name: <input type="text"> <input type="submit" value="Send"> </form> </body> [type=submit] { background: red; } Web page title index.html Name: Send READY TO USE CODE
  • 10. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Attribute presence 
 and value selectors [attribute] [attribute=value] [attribute~=value] [attribute|=value]
  • 11. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com ATTRIBUTE SELECTOR With this code all elements with the attribute target and the value deal are shown in green. Selects all elements with a specific attribute, but only if the value is one of a space-separated list of words. [data-item~=deal] {color: green} Syntax [attribute~=value] {style properties}
  • 12. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser ATTRIBUTE SELECTOR <body> <article data-item="food deal choco"> <h2>Best chocolate ever!</h2> <p>Product info.</p> </article> <article data-item="food choco"> <h2>Just white chocolate</h2> <p>Product info.</p> </article> </body> [data-item~=deal] { color: green; } Web page title index.html Best chocolate ever! Product info. Just white chocolate Product info. READY TO USE CODE
  • 13. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Attribute presence 
 and value selectors [attribute] [attribute=value] [attribute~=value] [attribute|=value]
  • 14. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com ATTRIBUTE SELECTOR With this code all elements with the hreflang attribute and 
 its value beginning with en are shown in green. Selects all elements with a specific attribute if their value is exactly a particular text or begins with it. [hreflang|=en] {color: green} Syntax [attribute|=value] {style properties}
  • 15. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser ATTRIBUTE SELECTOR <body> <a href="#" hreflang="en">Wikipedia English</a><br> <a href="#" hreflang="en-us">Wikipedia US</a><br> <a href="#" hreflang="en-gb">Wikipedia UK</a><br> <a href="#" hreflang="fr">Wikipedia France</a> </body> [hreflang|=en] { color: green; } Web page title index.html Wikipedia English Wikipedia US
 Wikipedia UK
 Wikipedia France READY TO USE CODE
  • 16. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com ATTRIBUTE PRESENCE 
 AND VALUE SELECTORS SUBSTRING MATCHING ATTRIBUTE SELECTORS
  • 17. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Substring matching 
 attribute selectors [attribute^=value] [attribute*=value] [attribute$=value]
  • 18. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com value ^Begins with *Contains $ Ends with
  • 19. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Substring matching 
 attribute selectors [attribute^=value] [attribute*=value] [attribute$=value]
  • 20. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com ATTRIBUTE SELECTOR With this code all elements with the data-item attribute and 
 its value beginning with food are shown in green. Selects all elements with a specific attribute if their value begins with a particular text. [data-item^=food] {color: green} Syntax [attribute^=value] {style properties}
  • 21. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser ATTRIBUTE SELECTOR <body> <article data-item="food choco black"> <h2>Best chocolate ever!</h2> <p>Product info.</p> </article> <article data-item="choco food white"> <h2>Just white chocolate</h2> <p>Product info.</p> </article> </body> [data-item^=food] { color: green; } Web page title index.html Best chocolate ever! Product info. Just white chocolate Product info. READY TO USE CODE
  • 22. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Substring matching 
 attribute selectors [attribute^=value] [attribute*=value] [attribute$=value]
  • 23. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com ATTRIBUTE SELECTOR With this code all elements with the data-item attribute and 
 its value containing food are shown in green. Selects all elements with a specific attribute if their value contains a particular text. [data-item*=food] {color: green} Syntax [attribute*=value] {style properties}
  • 24. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser ATTRIBUTE SELECTOR <body> <article data-item="choco food black"> <h2>Best chocolate ever!</h2> <p>Product info.</p> </article> <article data-item="choco white food"> <h2>Just white chocolate</h2> <p>Product info.</p> </article> </body> [data-item*=food] { color: green; } Web page title index.html Best chocolate ever! Product info. Just white chocolate Product info. READY TO USE CODE
  • 25. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com Substring matching 
 attribute selectors [attribute^=value] [attribute*=value] [attribute$=value]
  • 26. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com ATTRIBUTE SELECTOR With this code all elements with the data-item attribute and 
 its value ending with food are shown in green. Selects all elements with a specific attribute if their value ends with a particular text. [data-item$=food] {color: green} Syntax [attribute$=value] {style properties}
  • 27. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com HTML CSS Browser ATTRIBUTE SELECTOR <body> <article data-item="choco food black"> <h2>Best chocolate ever!</h2> <p>Product info.</p> </article> <article data-item="choco white food"> <h2>Just white chocolate</h2> <p>Product info.</p> </article> </body> [data-item$=food] { color: green; } Web page title index.html Best chocolate ever! Product info. Just white chocolate Product info. READY TO USE CODE
  • 28. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com ATTRIBUTE PRESENCE 
 AND VALUE SELECTORS SUBSTRING MATCHING ATTRIBUTE SELECTORS
  • 29. CSS FUNDAMENTALS: Build a strong foundation by solving real cases inarocket.com REFERENCE: W3C SOURCE: Selectors Level 3 by W3C.
  • 30. Learn front-end development at rocket speed inarocket.com by miguelsanchez.com YOU CAN CONTINUE THIS COURSE FOR FREE ON + READY TO USE CODE + QUIZZES + FREE UPDATES
  • 31. We respect your time
 No more blah blah videos. Just straight to the point slides with relevant information. Ready to use code
 Real code you can just copy and paste into your real projects. Step by step guides
 Clear and concise steps to build real use solutions. No missed points. Learn front-end development at rocket speed inarocket.com
  • 32. IN A ROCKET Learn front-end development at rocket speed CSS CSS FUNDAMENTALS SelectorsAttribute