Skip to content
    SeaCode
    Learning tracksCode ArenaWorkshops & EventsInstructors
    Log inSign up
    { }CSS

    Styling foundations

    • What is CSS?
    • Cascade and specificity
    • Selectors and element states
    • Colours and text

    Boxes and sizing

    • Padding, border and margin
    • Units and flexible sizing
    • Overflow and image fitting

    Layout and responsiveness

    • Flexbox
    • CSS Grid
    • Positioning and stacking
    • Responsive design
    • Container-based responsiveness

    Design values, direction and motion

    • CSS custom properties and functions
    • Logical properties for RTL and LTR
    • CSS transitions and transforms
    • Keyframes and bounded animation
    • Project: a product card
    CSS

    Design values, direction and motion · Lesson 15 of 17

    CSS transitions and transforms

    Animate state changes while respecting reduced motion.

    8 minutes1 games

    A transition interpolates between values when state changes. Specify the property, duration and easing. transform visually moves or scales an element without rearranging its neighbors. Use small purposeful motion and respect prefers-reduced-motion.

    HTML
    <style>
      button {padding:12px 20px;transition:transform 150ms ease-out;background:teal;color:white;border:0;}
      button:hover {transform:translateY(-2px);}
      button:focus-visible {outline:3px solid navy;outline-offset:3px;}
      @media (prefers-reduced-motion: reduce) {button {transition:none;} button:hover {transform:none;}}
    </style>
    <button>Hover or focus me</button>
    .tile { transform: none; }

    Try transforms; the element’s flow space stays unchanged.

    Important

    Avoid transition:all; name the intended properties. Motion must not be the only way to understand state.

    Interview question

    Does transform change the space reserved in layout?

    Exercise

    Move .box visually 10px right using transform.

    HTML
    <style></style><div class="box">Box</div>

    Learn more from

    • MDN: CSS referencedeveloper.mozilla.org
    • web.dev: transitionsweb.dev

    Played 0 of 1 games

    Sign in to save your progress and earn XP.

    PreviousLogical properties for RTL and LTRNextKeyframes and bounded animation
    SeaCode

    Learn to code for real, online or at our branch in front of Cairo University, Giza.

    Learn

    • All courses
    • Interactive tutorials
    • Interview practice problems
    • Mock interview
    • Learning tracks
    • Code Arena
    • Workshops & Events
    • Knowledge library
    • Team projects

    Your account

    • Log in
    • Sign up
    • Learning plan
    • Certificates
    • Site map

    Contact us

    • WhatsApp
    • 010 9094 1104
    • In front of Cairo University, Giza

    © 2026 SeaCode. All rights reserved.