2024 css reset

Is that actually a good practice🤫
No description
10 Replies
clevermissfox
clevermissfox5mo ago
I have the text-wrap: balance and box-sizing: border-box in my reset. I like to use svh vs dvh if I’m needing to declare a min-height in the body. I do wonder “why the position: relative?” On the *selector. The only think that comes to mind is to be able to use z-index on an element without giving them a position themselves. If that’s the reason I think it’s a bit overkill. Curious what the actual reason is. 🤔
ChooKing
ChooKing5mo ago
This code doesn't reset margins and padding. Also, dvh should be used in combination with vh, because it is still too new to use alone. The 100vh should come before 100dvh. This allows the 100vh to be overridden by the 100dvh in browsers that understand it. This also allows the 100vh to be used on browsers that don't understand dvh. They will just ignore the dvh. Without the 100vh, browsers that don't understand dvh will not have the height set at all. I forgot to also add that the universal selector does not select pseudo elements.
GHOST 👻
GHOST 👻5mo ago
That's the annotations that the creator add fr 😐
No description
GHOST 👻
GHOST 👻5mo ago
@hart❤🔥 have a look a the comments of the creator😅
ChooKing
ChooKing5mo ago
I disagree with this. It is not common enough that you would need to anticipate the use of top, left, right, and bottom. When you want to use them, add the postion: relative. You don't need it on all elements.
GHOST 👻
GHOST 👻5mo ago
@ChooKing yep absolutely true Kevin said that before the vh comes first than the dvh cause like you said its totally new but i think we can include both of them at the same time than the browser chose the dvh if supported if not its gonna go with vh only 😋 @ChooKing me too absolutely cause position relative could be problematic if you want to position a nested child 💯
Jochem
Jochem5mo ago
if you put the dvh below the vh, yes
althepal78
althepal785mo ago
why would you want to make every element relative? It looks like it will mess up when you trying to use absolute
Coder_Carl
Coder_Carl5mo ago
I would not use the position relative. this can lead to creating stacking contexts too easily by mistake which causes lots of problems
clevermissfox
clevermissfox5mo ago
Echoing to def not include the position relative, it’s unnecessary and could (and prob will) lead to issues.