CSS Fonts, Text & Color Properties
CSS Font Properties
Property Description Example
font-family Sets the font of the text font-family: Arial, sans-serif;
font-size Sets the size of the font font-size: 16px;
font-style Sets font style (italic, normal, oblique) font-style: italic;
font-weight Sets thickness/boldness of font font-weight: bold; or 400
font-variant Displays small-caps font-variant: small-caps;
line-height Sets space between lines line-height: 1.5;
letter-spacing Spacing between characters letter-spacing: 2px;
word-spacing Space between words word-spacing: 10px;
font Combines several font properties font: italic 16px Arial;
CSS Text Properties
Property Description Example
color Sets the color of the text color: #333; or color: red;
text-align Aligns text (left, center, right, justify) text-align: center;
text-decoration Underline, overline, line-through, none text-decoration: underline;
text-transform Capitalizes or changes case text-transform: uppercase;
text-indent Indents the first line of a paragraph text-indent: 20px;
white-space Controls whitespace handling white-space: nowrap;
direction Text direction (ltr or rtl) direction: rtl;
text-shadow Adds shadow to text text-shadow: 2px 2px #888;
word-break Breaks long words word-break: break-word;
CSS Color Properties
Property Description Example
color Text color color: #000;
background-color Sets the background color background-color: yellow;
border-color Sets the color of borders border-color: red;
opacity Sets transparency (0 to 1) opacity: 0.7;
rgba() / hsla() Advanced color functions (with alpha) color: rgba(255,0,0,0.5);