CSS Properties and Their Meanings
This document provides a table of the most important CSS properties, their meanings, and
example usage.
Property Purpose Example Code
color Sets the text color color: red;
background-color Sets the background color background-color: yellow;
font-size Sets the size of the font font-size: 16px;
font-family Sets the font type font-family: Arial, sans-
serif;
text-align Aligns the text text-align: center;
margin Sets the outer space around margin: 20px;
elements
padding Sets the inner space inside padding: 10px;
the border
border Sets border around an border: 1px solid black;
element
width Sets the width of an element width: 100px;
height Sets the height of an height: 200px;
element
display Defines the display display: block;
behavior
position Defines element positioning position: absolute;
top / left / right / bottom Offsets for positioned top: 10px;
elements
z-index Sets stack order of elements z-index: 1;
overflow Handles overflowed content overflow: auto;
float Floats an element left or float: left;
right
clear Stops floating clear: both;
visibility Shows or hides an element visibility: hidden;
opacity Sets the transparency level opacity: 0.5;
box-shadow Adds shadow to boxes box-shadow: 2px 2px 5px
gray;
text-shadow Adds shadow to text text-shadow: 1px 1px 2px
black;
cursor Changes the mouse cursor cursor: pointer;
transition Smoothly animates transition: all 0.3s ease;
property changes
transform Transforms elements (scale, transform: rotate(45deg);
rotate)
flex Applies flexbox to layout display: flex;
justify-content Aligns items on main axis justify-content: center;
align-items Aligns items on cross axis align-items: center;
grid Applies grid layout display: grid;
gap Sets gap between grid/flex gap: 10px;
items
animation Defines animation behavior animation: fadeIn 2s ease-
in;