BodinglesTM - -   Bright Lightbulb Graphic Ideas   - -

The Web Developer Bootcamp 2024

Colt Steele

Back to CSS Reference Index


CSS Transforms

The Transform CSS property lets you rotate, scale, skew, or translate an element. It modifies the coordinate space of the CSS visual formatting model.


While Transforms are similar to Transitions, in the sense that they both "change" the way an element is displayed, however, Transitions do it through a timed, and animated process but with Transforms, the "change" is immediate, and with no animations.

If the property has a value different from none, a stacking context will be created. In that case, the element will act as a containing block for any position: fixed; or position: absolute; elements that it contains.

If the property has a value different from none, a stacking context will be created. In that case, the element will act as a containing block for any position: fixed; or position: absolute; elements that it contains.

*Warning: Only transformable elements can be transformed. That is, all elements whose layout is governed by the CSS box model except for: non-replaced inline boxes, table-column boxes, and table-column-group boxes.

Here are a few examples

Original Box

Original Box

Rotate around a fixed point

transform: rotate(10deg);

Scale an element

transform: scale(0.75);


There are many transform options available. Click Here for a list of option, and proper syntax.

Basic Button Manipulation


This effect is done with simple CSS, changing the colors and shadow properties, and a simple Transform to change the button's position.

    HTML
  • < button>CLICK ME< /button>
    CSS
  • button
    • margin: 20px auto 40px;
    • padding: 10px 20px;
    • color: white;
    • font-weight: bold;
    • background-color: #689996;
    • border: 1px solid black;
    • border-radius: 15px;
    • box-shadow: 2px 2px 6px #888888;
  • button:hover
    • color: black;
    • background-color: #5eeee4;
    • box-shadow: 2px 2px 6px black inset; | (change the shadow to inset)
    • transform: translate(6px, 6px); | (move the same amount as the shadow size)


Back to Top