Some useful tools and interesting code
- https://marksheet.io
- Google and @mdo styleguides
nestedCSS (but not for&-and@mediaonly at root)1@media (orientation portrait)is a nice shoe-in for mobiles. (can also uselandscape)@media (prefers-color-scheme: dark)overrides.(I don't like these much)@layerand how and why to use cascade layersgrid(examples for layout, major sections)2subgridis occasionally handy.
flexbox(for alignment, small sections)2:empty:only-childand:only-of-typenth-childfiltertab-sizeis useful forpreblocks?~general sibling selector (not+adjacent) and spacing (Unicode chars)
optical-sizea great primerfont-variation-settings
aspect-ratio(andobject-fit)
marginandpaddingorder:top | right | bottom | leftandtop | left and right | bottom(clockwise)@media printand@page@media print and (prefers-color-scheme: dark)multiple@mediaqueries.content: " (" attr(href) ")";ora[href]:after { content: none; }(display link)
margincollapse (but not forinline-block!)table trborder won't style withoutborder-collapseon thetable.
I don't think there's any point listing these until they're widely adopted. It also adds another layer of complexity and cognitive load.
Things like html5 web components and css mixins. Wherever possible avoid javascript and use plain HTML and CSS: most programming languages have templates and {{ tags }} anyway.
Footnotes
-
This has pretty good coverage for modern browsers, but a few (only a few) still don't support it. It'd be wise, for now, to continue using
.less(or.sass) files and compile to regular CSS. They're also handy for chunking your files, which regular css can't do (still) ↩ -
In my mind both of these are fucking confusing. A simple question to ask yourself when deciding between grid or flexbox is: do I only need to control the layout by row or column? (use a flexbox); do I need to control the layout by row and column (use a grid). ↩ ↩2