====== HTML and CSS gotchas ====== ===== Change others ===== On a CSS hover event, change another div's styling. Without elements between: #a:hover + #b { background: #ccc } ...
Div A
Div B
On a CSS hover event, change another div's styling. With elements between: #a:hover ~ #b { background: #ccc } ...
Div A
random other elements
random other elements
random other elements
Div B
Remove inherited attributes: .gtd-button { all: unset; position: absolute; z-index: 10000; ... ===== CSS Selectors ===== ^ Selector ^ Example ^ Example description ^ | .class | .intro | "Selects all elements with class=""intro""" | | .class1.class2 | "
...
" | Selects all elements with both name1 and name2 set within its class attribute | | .class1 .class2 | "
...
" | Selects all elements with name2 that is a descendant of an element with name1 | | #id | #firstname | "Selects the element with id=""firstname""" | | * | * | Selects all elements | | element | p | Selects all

elements | | element,element | div, p | Selects all

elements and all

elements | | element element | div p | Selects all

elements inside

elements | | element>element | div > p | Selects all

elements where the parent is a

element | | element+element | div + p | Selects all

elements that are placed immediately after

elements | | element1~element2 | p ~ ul | Selects every