Sets the opacity for a color
Ranges from 0 to 1
rgba(255, 255, 255, 0.3); /* White with 30% opacity */Sets the opacity for the element
Ranges from 0 to 1
opacity: 0.5; /* Element is 50% transparent */Transition enable you to define the transition between two states of an element
property name | duration | timing-function | delay
transition: margin-top 2s ease-in-out 0.2;This property lets you rotate, scale, skew, or translate an element
/* Rotate */
transform: rotate(45deg); /* Rotates 45 degrees */
/* Scale */
transform: scale(0.5); /* Shrinks to 50% size */
transform: scale(0.5, 2); /* Width 50%, Height 200% */
transform: scaleX(0.5); /* Width 50% */
transform: scaleY(0.5); /* Height 50% */
/* Translate */
transform: translate(50px, 50px); /* Moves right 50px, down 50px */
transform: translateX(10px); /* Moves right 10px */
transform: translateY(10px); /* Moves down 10px */
/* Skew */
transform: skew(45deg); /* Slants element 45 degrees horizontally (X-axis) */It adds shadow effects around an element's frame
box-shadow: 2px 2px 10px green; /* offset-x | offset-y | blur | color */Lets you set an image as a background
background-image: url("image.jpg");
background-size: contain; /* No crop, No scale, Only repeat image to fill the area */
background-size: cover; /* Crop but not scale */
background-size: auto; /* Stretch the image to fit */The position CSS property sets how an element is positioned in a document.
The top, right, bottom, and left properties determine the final location of positioned elements.
- static
- relative
- absolute
- fixed
The top, right, bottom, left, and z-index properties have no effect.
This is the default value.
position: static;The offset is relative to itself based on the values of top, right, bottom, and left.
position: relative;The element is removed from the normal document flow, and no space is created for the element in the page layout.
It is positioned relative to its closest positioned ancestor, if any; otherwise, it is placed relative to the initial containing block.
position: absolute;The element is removed from the normal document flow, and no space is created for the element in the page layout.
It is positioned relative to the initial containing block established by the viewport.
position: fixed;