An Interest In:
Web News this Week
- March 14, 2024
- March 13, 2024
- March 12, 2024
- March 11, 2024
- March 10, 2024
- March 9, 2024
- March 8, 2024
The 3 Short December CSS tips
Hey folks!
Id like to talk about why you should define what you need to define, the poor habit to define display: block for pseudo-elements ::before and ::after, what to better between align-items: center and margin: auto.
But before embarking on reading I leave the link on my Substack newsletter about CSS. If you wanna read more tips you know what to make
Also, thank you so much, my sponsors: Ben Rinehart, Tatiana Ten, Konstantinos Kapenekakis. I didnt write this article without their support.
Define only what you need to define
Theres the perfect trick to write scalable CSS that wont make you suffer. Dont define what is unnecessary. If you need to define a background color make it with background-color and not with background
display: grid gets rid of the habit of defining display: block
Are you used to defining display: block for ::before or ::after? Folks, there is no need to make it if you define display: grid or display: inline-grid to the parent. Browsers make it themselves
align-items: center or margin: auto. Whats better?
Warning! Using justify-content or align-items might lead to losing data. Its why I cant close a dialog. margin: auto is the best alternative
Original Link: https://dev.to/melnik909/the-3-short-december-css-tips-1m31
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To