CSS Properties - Web4U

Explore CSS Properties

Table of Contents

color

Sets the text color of an element.

p {
    color: red;
}
        
Color Example

More info: W3C color property

background-color

Sets the background color of an element.

div {
    background-color: lightblue;
}
        
Background Color Example

More info: W3C background-color

margin

Sets the outer space of an element.

div {
    margin: 20px;
}
        
Margin Example

Note: Background color and border added to better visualize the margin effect.

More info: W3C margin property

padding

Sets the inner space between content and border.

div {
    padding: 15px;
}
        
Padding Example

Note: Background color and border added to better visualize the margin effect.

More info: W3C padding property

display

Defines how an element is displayed in the layout.

div {
    display: inline-block;
}
        
Display Example

More info: W3C display property