CSS offers various ways to style elements with color. Colors can be specified using names, hexadecimal values, or RGB/RGBA values.
p {
color: red; /* color name */
background-color: #00ff00; /* hexadecimal */
border-color: rgb(0,0,255); /* RGB */
opacity: 0.8; /* transparency */
}
Units
In CSS, sizes can be specified using different units: px for pixels, % for relative values, em/rem for font size, vh/vw for viewport height/width percentages.
div {
width: 50%; /* 50% of parent width */
height: 10vh; /* 10% of viewport height */
padding: 1em; /* 1 times font size */
}
border-radius
border-radius allows you to round the corners of boxes. Values can be specified in px or percentages.