Css Demystified Start Writing Css With Confidence [updated]
: If two rules have the exact same weight, the one written last wins.
.button background: gray; .button background: blue; /* wins */ CSS Demystified Start writing CSS with confidence
By default, CSS uses content-box . This means if you set a width: 200px , add padding: 20px , and a border: 5px , the actual visible width becomes (200 + 20 + 20 + 5 + 5). This causes layouts to break unexpectedly. : If two rules have the exact same
If you cannot see where an element begins or ends, add a temporary style like outline: 2px solid red; . Unlike borders, outlines do not take up space or affect the layout. .button background: blue