CSS Programming Cheatsheet
Selector
Selects all elements
element
Selects all <element> tags
#id
Selects an element with a specific id
.class
Selects all elements with a specific class
element1, element2
Selects all specified elements
element element
Selects all <element> inside another element
element > element
Selects direct child elements
Property
color
Sets the text color
background-color
Sets the background color
font-size
Sets the size of the font
font-family
Sets the font type
text-align
Aligns the text (left, center, right)
margin
Sets outer space around elements
padding
Sets inner space around content
border
Sets border width, style, and color
width / height
Sets the width/height of an element
display
Sets display type (block, inline, flex, none)
position
Sets position (static, relative, absolute, fixed)
z-index
Sets stack order of elements
overflow
Controls content overflow (visible, hidden, scroll)
float / clear
Floats an element or clears float