Arslan Khalid Profile picture
Sep 11, 2020 9 tweets 3 min read Read on X
A 🧵about CSS Selectors:

Going from Easy -> Complex...

👇
These are the commonly used CSS selectors:

1. Universal Selector ( * )

2. Element Selector ( p , a , div , ... )

3. Class Selector ( .my-class )

4. Id Selector ( #CSS 😉)

👇 Common CSS selectors
5. Attribute Selectors

👇 How to use attribute select...
Attribute Selectors with Regular Expressions (Regex):

Crazy right. Let's explore.

👇 How to use RegEx with attri...
6. Complex Selectors

They use different combinators like:

a. Descendant combinator ( space )

b. Child combinator ( > )

c. Sibling combinator ( + )

d. Subsequent combinator ( ~ )

Let's see what they do:

👇 How to use complex selectors?
Note:

The descendant combinator (space) is recursive. For example:
ul li {...}
will style all the 'li' elements inside 'ul' even if the 'li' does not have 'ul' as direct parent.

Use it with caution!

It is advised to use child combinator ( > ) to avoid recursive styling.

👇
7. Compound Selectors

As the name suggests they are a combination of different selectors.

Let's see it in practice.

👇 How to use Compound Selecto...
Last but not least!

The Rulers of the Phantom World:

Pseudo Elements and Pseudo Classes.

They deserve a thread of their own but here's a teaser:

👇 How to use pseudo elements ...
These are the selectors available at your disposal to make wonderful experiences on the world wide web.

Go make something beautiful.

Thanks for reading.

More coming in the pipeline. Stay tuned.

• • •

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

Keep Current with Arslan Khalid

Arslan Khalid 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 @thearslankhalid

Oct 2, 2020
CSS Animations:

Usage and Performance and Tips

🧵A thread 🧵
Usage:

Only two properties are required for a CSS animation.

1. animation-name
2. animation-duration

All other properties are optional.
@ keyframes is the timeline for an animation:

You can use it in the following two ways. ImageImage
Read 8 tweets
Oct 1, 2020
CSS Easing Functions:
Easing is a word used to describe the acceleration and deceleration of a transition or an animation along a timeline.

We can plot this a graph.

The graph for a linear easing is a straight line. Image
Animation timing function property in CSS allows to specify the easing.

We have 5 easing functions already baked into CSS. Image
Read 7 tweets
Sep 25, 2020
CSS Transitions:

Usage and Performance

🧵A thread 🧵
Usage:

Only two properties are required for a CSS transition.

1. transition-property
2. transition-duration

The other two properties are optional ( transition-delay and transition timing function )
There are two ways to use transitions.

A. You could break everything.
B. Shorthand.
Read 9 tweets
Sep 24, 2020
Getting😎with JSON:

( 🧵A mini-thread🧵 )

JSON is used to exchange data with server.

Consider you are a developer for a car showroom and you need to add new cars to your database.

For example the new cars JavaScript Object is:

#javascript #100DaysOfCode
Servers receive data in string format.

So you have to convert to your new cars JavaScript object to a string.

JSON.stringify() function can help you do that.

Here's how:
When getting data from server, the data is always a string.

You can use JSON.parse() function to convert the received cars data into JavaScript object.

For example:
Read 4 tweets
Sep 20, 2020
🔥Git Good Practices

1. Make clean commits:

Don't do too much on one commit.

Fix one bug, commit, fix second bug, commit and so on.

Break features into steps and repeat the clean commit process.
2. Good commit messages:

Capitalized, meaningful names in the present tense is the best commit message practice.

Example:

Added responsiveness to the website
3. Commit often:

Create small commits for any meaningful update that you make.

For example, when you add a new section or code a new component.
Read 5 tweets
Sep 18, 2020
CSS Property ( will-change )

The will-change property hints the browsers what properties are going to change.

Therefore, helping the browser set up optimizations before an element is actually changed.

This is great for optimizing animations / transitions.

Here's how it's done Image
Although it seems cool to use will-change as much as you can to optimize the performance of the page.

It's recommended to use on elements that are sure to change like sliders, modals.
Moreover, will-change property should only be used to tackle performance issues not anticipate them.

Optimizations use machine resources to accelerate the rendering process and it can become a lot labor intensive for browser to optimize unnecessary elements.
Read 6 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!

:(