4 ms·
It's a cool little snippet but it's nothing more than three run-of-the-mill CSS declarations. The maximum width is specified, a small padding is applied and the
by Raphmedia 8y ago
It's a cool little snippet but it's nothing more than three run-of-the-mill CSS declarations.
The maximum width is specified, a small padding is applied and the margins around the element are set to automatic so it centers itself horizontally.
All the other styles applied on this pages are not part of the snippet. The weight of the titles, the spacing under the paragraphs, etc., are all specified on the page's CSS file but not described in the blogpost itself. [0]
I was expecting something akin to normalize.css[1] which normalize the default styles of your page[2].
There are multiple very lightweight CSS "frameworks" that you should carry around instead of the snippet shown here. We are talking ~5KB. See https://github.com/troxler/awesome-css-frameworks#very-light https://github.com/troxler/awesome-css-frameworks#very-light for a great list.
[0] https://jrl.ninja/etc/post.css https://jrl.ninja/etc/post.css
[1] http://nicolasgallagher.com/about-normalize-css/ http://nicolasgallagher.com/about-normalize-css/
[2] Normalize CSS aims to make built-in browser styling consistent across browsers. Elements like H1-6 will appear bold, larger et cetera in a consistent way across browsers. You're then supposed to add only the difference in decoration your design needs.