Over a million developers have joined DZone.
Platinum Partner

CSS3 Transitions: A Small Tutorial

· Web Dev Zone

The Web Dev Zone is brought to you in partnership with Mendix. Download this Forrester Report to gain a better understanding of the low-code platform market and how to make a strategic platform selection you won’t regret.

  • "Transition" refers to a change of the state of an object.
  • In CSS3 we can show the transition of an object using a transition property. Variations of this property for different browsers are:  transition,-moz-transition, -moz-transform ,-webkit-transition, -webkit-transform,-o-transition.
  • The other transition properties have duration, property, delay and timing functions to control the CSS3 transition.

Testing CSS3 Transition:-

  • The HTML CSS3 transition code css3Demo.html ,
    <!DOCTYPE html>
            <title>CSS3 Transition Demo</title>
                div.name {
                    border:4px solid red;
                    transition:border 2s, border-radius 2s, color 2s;
                    -moz-transition:border 2s, border-radius 2s;
                    -webkit-transition:border 2s, border-radius 2s;
                    -o-transition:border 2s, border-radius 2s;
                div.name:hover {
                    border:4px solid yellow;
            <div class="name">SANDEEP</div>
  • Firebug Inspection ,


  • It displays the square on "LOAD" of HTML page,
  • On "HOVER" of that div element the transition occurs and becomes round with change in border radius,color and border style. The result will look like:

The Web Dev Zone is brought to you in partnership with Mendix. Better understand the aPaaS landscape and how the right platform can accelerate your software delivery cadence and capacity with the Gartner 2015 Magic Quadrant for Enterprise Application Platform as a Service.


Published at DZone with permission of Sandeep Patel , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}