Today I Learned - Rocky Kev

TIL A nice way to use calc to get margin space

POSTED ON:

TAGS:

I love it when bootstrap containers automatically create padding based on size.

// margin method
.container
{
margin: 2rem 5rem;
}


// using calc method
.container
{
max-width: calc(100% - 10rem);
margin: 0 auto;
}

The margin method always keeps the content centered, which is one benefit.

But I like the calc method, because regardless of the screen size, there's a lot more control with math.


Related TILs

Tagged:

TIL the alternate keyword

If 'alternate' appears along with the stylesheet keyword, the linked file is an alternative stylesheet. It won’t be applied to the document, but it will be ready for when we need it.

TIL Logical Properties

For that sweet sweet Internationalization you want to avoid directional words like 'left', 'right', 'top', and 'bottom'.

TIL Using pseudo-classes in your querySelector!

let notTuna = document.querySelectorAll('.sandwich:not(.tuna)')