Created
June 2, 2018 10:04
-
-
Save cesarandreu/3e87cb6993bedeb162b5648222eb67bf to your computer and use it in GitHub Desktop.
Sensible css defaults taken from css-layout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div, span { | |
box-sizing: border-box; | |
position: relative; | |
display: flex; | |
flex-direction: column; | |
align-items: stretch; | |
flex-shrink: 0; | |
align-content: flex-start; | |
border: 0 solid black; | |
margin: 0; | |
padding: 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Taken from css-layout README:
box-sizing: border-box
is the most convenient way to express the relation betweenwidth
andborderWidth
.display: flex
by default. All the behaviors ofblock
andinline-block
can be expressed in term offlex
but not the opposite.position: relative
. This makesposition: absolute
target the direct parent and not some parent which is eitherrelative
orabsolute
. If you want to position an element relative to something else, you should move it in the DOM instead of relying of CSS. It also makestop, left, right, bottom
do something when not specifyingposition: absolute
.