css

Cool tricks with CSS.

Convention

Don't use Margin

Don't use MarginMargin breaks component encapsulation because components impacteverything surrounding them and external to them. It also makesreusability difficult and impacts external components. The stackcomponent, similar to other spacer components, is useful for addingarbitrary spaces internal to and external from different components.THese help define discrete units for space as well which can bestandardized across the application.

Computation

CSS can do a lot more than we use it for: it cancount,for one.

Vulnerabilities

saizai/cssfingerprint: a research project to see how well the CSShistory hack can fingerprint auser

Do not blindly copy paste

source In thiscode segment, it's trivial to hide the truth of the text that's beingcopied, thus resulting in a blind paste into terminal being malicious:


silly

One way the author recommends safe pasting is via this command:

alias prepaste='builtin fc -e "vim -c %d -c \"set paste\""'

This opens the line pasted in vim before sending it to the browser,encouraging you to preview and edit it.

Alignment tricks!

Ten modern layouts in one line ofCSS

Transform

transform() operations occur outside of the flexbox algorithm, so thingscan be displayed with flexbox then instantly transformed to their properposition as desired. This also allows us to place an element entirelyout of the document flow! (adding a 'close' button, for example).

Revisions
DateHash
2023-02-22
Navigation
Previousprob-stat
Nextposix
Uppages