Search
Is it better to use ems/rems than px for font-size?
10.1.2020
The answer used to be absolutely yes because, if you used px units, you prevented the text from being resized by the user at all.
But browser zoom is the default method for making everything bigger (including text) these days and it works great even if you use px.
But... Kathleen McMahon really...
Oh Hey, Padding Percentage is Based on the Parent Element’s Width
13.11.2019
I learned something about percentage-based (%) padding today that I had totally wrong in my head! I always thought that percentage padding was based on the element itself. So if an element is 1,000 pixels wide with padding-top: 50%, that padding is 500 pixels. It's weird having top padding based...
Responsive Iframes
25.7.2019
Say you wanted to put the CSS-Tricks website in an <iframe>. You'd do that like this:
<iframe src="https://css-tricks.com"></iframe>
Without any other styling, you'd get a rectangle that is 300x150 pixels in size. That's not even in the User Agent stylesheet, it's just some...
What if we got aspect-ratio sized images by doing almost nothing?
7.6.2019
Say you have an image you're using in an <img> that is 800x600 pixels. Will it actually display as 800px wide on your site? It's very likely that it will not. We tend to put images into flexible container elements, and the image inside is set to width: 100%;. So perhaps that image ends...
Collective #469
19.11.2018
Braces to Pixels * Statusfy * Stack * Arare * The Power of Web Components * Bruck * autoComplete.js * Degreeless.design
Collective #469 was written by Pedro Botelho and published on Codrops
Users DO Change Font Size
24.6.2018
Evan Minto:
The question was “How many users browse the main Internet Archive site with a default font size other than the common value of 16 pixels?” By knowing this, we would determine how many users would be affected by sizing with relative units like rems/ems.
Using the methodology I describe...
Manipulating Pixels Using Canvas
7.6.2018
Modern browsers support playing video via the <video> element. Most browsers also have access to webcams via the MediaDevices.getUserMedia() API. But even with those two things combined, we can’t really access and manipulate those pixels directly.
Fortunately, browsers have a Canvas...