Want to Contribute to us or want to have 15k+ Audience read your Article ? Or Just want to make a strong Backlink?

My 5 favorite tips to improve your CSS

Hey people!

CSS is magic for lots of people. So I am right here to assist. I wrote this text with my favourite suggestions. In case you prefer it you’ll read more tips in my newsletter.



border helps customers with photosensitivity to seek out component boundaries

background would not show with working system distinction settings enabled. Because of this, customers will not component boundaries. The answer is to make use of border: 1px stable clear 💡



The ability of CSS inheritance when defining line-height

The wrong code. line-height 1.5. It's applied to p, ul. The correct code. line-height 1.5. It's applied to body

Of us, I tousled. I forgot I can use CSS inheritance and add line-height to <physique> as a substitute of including it to <p>, <h*>, <ul>, et al. individually 😉



Remember to cease web page scrolling when making a customized scrollbar

The wrong code. height 100vh, overflow auto. The correct code. height 100vh, overflow auto and overscroll-behavior contain

Do you make the widget with customized scrolling? overscroll-behavior will care about your customers by stopping web page scrolling after scrolling your widget 💡



We need not use 0 anymore to outline margins and paddings

The wrong code. padding: 10px 0 15px, margin 0 10px 0 15px. The correct code. padding-block: 10px 15px, margin-inline: 15px 10px

I needed to make a not logical factor, i.e. use 0 to outline margins, paddings with reverse sides 😒 Now margin-block, margin-inline, padding-block, padding-inline assist us to make the identical with out 0 🥳



It’s time to make use of a brand new manner for centering parts with place: absolute

The wrong code. The parent has position relative. The child element has position absolute, top 50%, left 50%, transform translate(-50%, -50%). The correct code. The parent has display: grid, place-items: center. The child element has position absolute

Do you continue to use the previous snippet to the middle component with place: absolute utilizing remodel(-50%, -50%)? It’s time to make use of a brand new various! Meet place-items: heart 😉

P.S. Don’t forget to see more tips

Add a Comment

Your email address will not be published. Required fields are marked *

Want to Contribute to us or want to have 15k+ Audience read your Article ? Or Just want to make a strong Backlink?