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
BRKAPP-1102 - Proactive Network and Application Monitoring.pdf
fcesargonca
 
PDF
BRKSP-2551 - Introduction to Segment Routing.pdf
fcesargonca
 
PDF
The Convergence of Threat Behaviors Across Intrusions
Joe Slowik
 
PDF
Cybersecurity Nightmare_ 16 Billion Passwords Leaked in Data Breach by Orage ...
Orage Technologies
 
PPTX
My Mother At 66! (2).pptx00000000000000000000000000000
vedapattisiddharth
 
PPTX
Networking_Essentials_version_3.0_-_Module_3.pptx
ryan622010
 
PPTX
CHAPTER 1 - PART 3 FOR GRADE 11 STUDENTS
FSBTLEDNathanVince
 
PDF
google promotion services in Delhi, India
Digital Web Future
 
PDF
Strategic Plan New and Completed Templeted
alvi932317
 
PDF
Top 10 Testing Procedures to Ensure Your Magento to Shopify Migration Success...
CartCoders
 
PPTX
美国电子毕业证帕克大学电子版成绩单UMCP学费发票办理学历认证
Taqyea
 
PPTX
原版一样(毕业证书)法国蒙彼利埃大学毕业证文凭复刻
Taqyea
 
PPTX
Academic Debate: Creation vs Evolution.pptx
JOHNPATRICKMARTINEZ5
 
PDF
The Hidden Benefits of Outsourcing IT Hardware Procurement for Small Businesses
Carley Cramer
 
PPTX
西班牙巴利阿里群岛大学电子版毕业证{UIBLetterUIB文凭证书}文凭复刻
Taqyea
 
PDF
Digital burnout toolkit for youth workers and teachers
asociatiastart123
 
PDF
Learning Exemplar_Technology and Livelihood Education 7 Q1_W2.pdf
mjhiludo16
 
PDF
Enhancing Parental Roles in Protecting Children from Online Sexual Exploitati...
ICT Frame Magazine Pvt. Ltd.
 
PDF
web application development company in bangalore.pdf
https://dkpractice.co.in/seo.html tech
 
PDF
FutureCon Seattle 2025 Presentation Slides - You Had One Job
Suzanne Aldrich
 
BRKAPP-1102 - Proactive Network and Application Monitoring.pdf
fcesargonca
 
BRKSP-2551 - Introduction to Segment Routing.pdf
fcesargonca
 
The Convergence of Threat Behaviors Across Intrusions
Joe Slowik
 
Cybersecurity Nightmare_ 16 Billion Passwords Leaked in Data Breach by Orage ...
Orage Technologies
 
My Mother At 66! (2).pptx00000000000000000000000000000
vedapattisiddharth
 
Networking_Essentials_version_3.0_-_Module_3.pptx
ryan622010
 
CHAPTER 1 - PART 3 FOR GRADE 11 STUDENTS
FSBTLEDNathanVince
 
google promotion services in Delhi, India
Digital Web Future
 
Strategic Plan New and Completed Templeted
alvi932317
 
Top 10 Testing Procedures to Ensure Your Magento to Shopify Migration Success...
CartCoders
 
美国电子毕业证帕克大学电子版成绩单UMCP学费发票办理学历认证
Taqyea
 
原版一样(毕业证书)法国蒙彼利埃大学毕业证文凭复刻
Taqyea
 
Academic Debate: Creation vs Evolution.pptx
JOHNPATRICKMARTINEZ5
 
The Hidden Benefits of Outsourcing IT Hardware Procurement for Small Businesses
Carley Cramer
 
西班牙巴利阿里群岛大学电子版毕业证{UIBLetterUIB文凭证书}文凭复刻
Taqyea
 
Digital burnout toolkit for youth workers and teachers
asociatiastart123
 
Learning Exemplar_Technology and Livelihood Education 7 Q1_W2.pdf
mjhiludo16
 
Enhancing Parental Roles in Protecting Children from Online Sexual Exploitati...
ICT Frame Magazine Pvt. Ltd.
 
web application development company in bangalore.pdf
https://dkpractice.co.in/seo.html tech
 
FutureCon Seattle 2025 Presentation Slides - You Had One Job
Suzanne Aldrich
 
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