CSS properties

5 useful CSS properties



1. color


Defines the text color inside an element.


p { color: red; }

W3C Reference



2. background


Allows setting a background color or image for an element.


div { background: yellow; }

W3C Reference



3. margin


Defines the outer space around an element.


h1 { margin: 20px; }

W3C Reference



4. padding


Defines the inner space between the content and the element's border.


div { padding: 10px; }

W3C Reference



5. border


Allows defining the style, width, and color of an element's border.


p { border: 1px solid black; }

W3C Reference