CSS isn't magic
Subscribe
Sign in
Home
Archive
About
New
Top
Discussion
We don't need to use 0 anymore to define margins and paddings
I had to make a not logical thing, i.e. use 0 to define margins, paddings with opposite sides š Now margin-block, margin-inline, padding-blockā¦
May 24
Ā ā¢Ā
Stas Melnikov
Share this post
We don't need to use 0 anymore to define margins and paddings
cssisntmagic.substack.com
Copy link
Twitter
Facebook
Email
Notes
Does flex-basis effect on the element with position: absolute?
flex-basis stops to work after applying position: absolute or fixed to the element because it is out of flex context. The right answer ā 1rem š” ⤠Thankā¦
May 17
Ā ā¢Ā
Stas Melnikov
1
Share this post
Does flex-basis effect on the element with position: absolute?
cssisntmagic.substack.com
Copy link
Twitter
Facebook
Email
Notes
position: absolute frees us from using display: block
Are you used to defining display: block for ::before or ::after? Folks, there is no need to make it if you define position: absolute. Browsers make itā¦
May 10
Ā ā¢Ā
Stas Melnikov
1
Share this post
position: absolute frees us from using display: block
cssisntmagic.substack.com
Copy link
Twitter
Facebook
Email
Notes
Create custom checkboxes and radio buttons with the attribute selector
The majority of developers define 2 classes for unchecked and checked states when creating custom checkboxes and radio buttons. Stop!š¤Let's use 1 classā¦
May 3
Ā ā¢Ā
Stas Melnikov
1
Share this post
Create custom checkboxes and radio buttons with the attribute selector
cssisntmagic.substack.com
Copy link
Twitter
Facebook
Email
Notes
April 2023
Is the element with position: absolute always positioned at the edge?
Browsers save the start position of the element after applying position: absolute if we don't define coordinates using the top, right, bottom, left andā¦
Apr 26
Ā ā¢Ā
Stas Melnikov
1
Share this post
Is the element with position: absolute always positioned at the edge?
cssisntmagic.substack.com
Copy link
Twitter
Facebook
Email
Notes
justify-content: space-between leads to weird display of items
Do you use justify-content: space-between to distribute the spacing between items evenly? Then you should know it works weird when the items count inā¦
Apr 19
Ā ā¢Ā
Stas Melnikov
1
Share this post
justify-content: space-between leads to weird display of items
cssisntmagic.substack.com
Copy link
Twitter
Facebook
Email
Notes
Use the power of CSS inheritance when defining line-height
Folks, I messed up. I forgot I can use CSS inheritance and add line-height to <body> instead of adding it to <p>, <h*>, <ul>, et al. separately š ā¤ā¦
Apr 12
Ā ā¢Ā
Stas Melnikov
1
Share this post
Use the power of CSS inheritance when defining line-height
cssisntmagic.substack.com
Copy link
Twitter
Facebook
Email
Notes
justify-content: center and align-items: center leads to data loss
Warning! Using justify-content or align-items might lead to losing data. It's why I can't close a dialog. margin: auto is the best alternative š ā¤ā¦
Apr 5
Ā ā¢Ā
Stas Melnikov
2
Share this post
justify-content: center and align-items: center leads to data loss
cssisntmagic.substack.com
Copy link
Twitter
Facebook
Email
Notes
March 2023
The gap property smashes margins!
Stop, stop, stop defining margins to set the gap between a few elements. gap helps to make it in one rule š ⤠Thank you so much, my sponsors: Benā¦
Mar 29
Ā ā¢Ā
Stas Melnikov
2
1
Share this post
The gap property smashes margins!
cssisntmagic.substack.com
Copy link
Twitter
Facebook
Email
Notes
Let's reduce the combination of the width and max-width properties to one
The min() function allows us to define values, and browsers will choose the smallest value from them. How can it be used? Define the width and max-widthā¦
Mar 22
Ā ā¢Ā
Stas Melnikov
1
Share this post
Let's reduce the combination of the width and max-width properties to one
cssisntmagic.substack.com
Copy link
Twitter
Facebook
Email
Notes
Reduce top: 0; right: 0; bottom: 0; left: 0 to one line!
Did you use the top, right, bottom and left properties to stretch elements over the full width and height of the parent? š¤ Reduce it to one line withā¦
Mar 15
Ā ā¢Ā
Stas Melnikov
1
Share this post
Reduce top: 0; right: 0; bottom: 0; left: 0 to one line!
cssisntmagic.substack.com
Copy link
Twitter
Facebook
Email
Notes
When is using display: block for ::before or ::after unnecessary?
Folks, did you define display: flex or display: inline-flex to the parent? Yeap? Stop defining display: block for ::before or ::after. Browsers make itā¦
Mar 8
Ā ā¢Ā
Stas Melnikov
2
Share this post
When is using display: block for ::before or ::after unnecessary?
cssisntmagic.substack.com
Copy link
Twitter
Facebook
Email
Notes
This site requires JavaScript to run correctly. Please
turn on JavaScript
or unblock scripts