Junaid ⚡ Profile picture
Jun 21, 2021 10 tweets 19 min read Read on X
💡CSS - Attribute Selectors you probably don't know about.

A thread...

#webdevelopment #webdesign #webdeveloper #html #website #coding #programming #css #javascript #development
1. Select element(s) having attribute of name ‘attr’. No matter what the value is.
👉 [attr]
Try it on Codepen: codepen.io/junaidshaikh_j…

#webdevelopment #webdesign #webdeveloper #html #website #coding #programming #css #javascript #development Image
2. Select element(s) having the attribute of name ‘attr’ whose value is having an exact match to ‘value’
👉 [attr = value]
Try it on Codepen: codepen.io/junaidshaikh_j…

#webdevelopment #webdesign #webdeveloper #html #website #coding #programming #css #javascript #development Image
3. Let’s say one of your elements has a class attribute having multiple classes separated by whitespace and you wanted to match the selector to one of the values in the list.
👉 [attr ~= value]

#webdevelopment #webdeveloper #html #website #coding #css #javascript
This selector will select an element having an ‘attr’ attribute whose value contains ‘value’ as an exact match in the list. (~ this character is called tilde)
Try it on Codepen: codepen.io/junaidshaikh_j…

#webdevelopment #webdeveloper #html #website #coding #css #javascript Image
4. Select element(s) having the attribute of name ‘attr’ whose value starts with ‘value’
👉 [ attr ^= value ]
Try it on Codepen: codepen.io/junaidshaikh_j…

#webdevelopment #webdesign #webdeveloper #html #website #coding #programming #css #javascript #development Image
5. Select element(s) having the attribute of name ‘attr’ whose value contains ‘value’ anywhere in the string
👉 [attr *= value]
Note: This value isn’t the exact match like [attr ~= value]
Try it on Codepen: codepen.io/junaidshaikh_j…

#javascript #CSS #webdevelopment #html Image
6. Select element(s) having an attribute of name ‘attr’ whose value ends with ‘value’
👉 [attr $= value]
Try it on Codepen: codepen.io/junaidshaikh_j…

#webdevelopment #webdesign #webdeveloper #html #website #coding #programming #css #javascript #development Image
7. Select element(s) having the attribute of name ‘attr’ whose value is the exact match of ‘value’ or having the value of ‘value’ which is immediately followed by hyphen (-)
👉 [attr |= value]
Try it on Codepen: codepen.io/junaidshaikh_j…

#webdevelopment #html #css #javascript Image
That's all for this thread. If you find this helpful, retweet the thread😃

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Junaid ⚡

Junaid ⚡ Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @junaidshaikh_js

Jun 17, 2022
7 Github repositories to level up your JavaScript skills

( Problem Solving, Algorithms and Data Structure, Interview Preparation)

A thread 🧵
1️⃣ Problem Solving JavaScript

Collection of interview questions with Unit Tests. Problems include Data Structures, Logical, and a few Classical problems.

🔗 github.com/knaxus/problem…
2️⃣ Interview Questions in JavaScript

A mostly reasonable collection of technical software development interview questions solved in Javascript in ES5 and ES6*

🔗 github.com/kennymkchan/in…
Read 9 tweets
Dec 10, 2021
10 Websites every developer must know 🔥🔥

A thread 🧵
1️⃣ Over API

Collection of all cheatsheets

🔗 overapi.com
2️⃣ Web Skills

Your resource guide for every skill you need for web development.

🔗 andreasbm.github.io/web-skills/
Read 12 tweets
Oct 22, 2021
6 Websites every frontend developer should know.

A thread 🧵
1️⃣ Web Skills

Your source guide for web skills.

🔗 andreasbm.github.io/web-skills/
2️⃣ Parrot Color

Get an awesome color palette for your next project.

🔗 parrot.color.pizza
Read 8 tweets
Sep 23, 2021
Top 7 Websites that will help you in resume building 💪

A thread:
1️⃣ Enhancv

🔗 enhancv.com
2️⃣ VisualCV

🔗 visualcv.com
Read 9 tweets
Sep 22, 2021
6 best CSS frameworks you should try in 2021

Which one do you use? and why?

A thread:
1. Bootstrap

🔗 getbootstrap.com
2. Foundation

🔗 get.foundation
Read 8 tweets
Aug 14, 2021
13 Websites that will help you improve your frontend skills by building real-world projects. 💪

A thread ⤵️
1️⃣ Frontend Mentor { @frontendmentor }

🔗 frontendmentor.io
2️⃣ 100 Days of CSS

🔗 100dayscss.com
Read 15 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(