The transitions can be used to animate the CSS properties, adding an animation effect when changing CSS property of a HTML element, to gradually change from one style to another.
The CSS3 transition has 4 components:
transition-property
- Specifies the name or names of the CSS properties to which 'transition' should be applied (like: width, color, font-size, etc.).transition-duration
- Specifies the duration over which transitions should occur, in seconds (s), milliseconds (ms), (default 0).transition-timing-function
- Describes how the speed during a transition will be calculated:transition-delay
- Defines how long to wait utill the transition will start (default 0)1. The CSS property you want to add an effect to ( transition-property ).- The last two components ( transition-timing-function and transition-delay ) are optional.
2. The duration of the effect ( transition-duration ).
<style> #iddv { width:90px; height:90px; background:#b8b9fe; font-size:18px; transition-property: width; transition-duration: 1.5s; } #iddv:hover { width:280px; } </style> <h4>Example transition width</h4> <div id='iddv'>Hover over this square.</div>
transition
shorthand property.<style> .clse { width:150px; font-size:12px; transition: font-size 0.5s ease-out; } .clse:hover { font-size: 18px; } </style> <h4>Example transition font-size</h4> <p>Place the cursor over each link.</p> <ul> <li class='clse'><a href='https://coursesweb.net/css' title='Free CSS Course'>Free CSS Course</a></li> <li class='clse'><a href='https://coursesweb.net/html' title='HTML Course'>HTML Course</a></li> <li class='clse'><a href='https://gamv.eu/' title='Flash Games'>Flash Games</a></li> </ul>
<style> .dv1 { width:115px; height:100px; position:relative; font-size:17px; text-align:center; padding-top:18px; } .clsdv { width:120px; height:100px; position:absolute; top:0; left:0; background:#b8b9fe; transition: background 1.3s, opacity 1.8s, transform 1.4s; } .clsdv:hover { background: #00da01; opacity:0.5; transform:rotate(180deg); } </style> <h4>Example transition multiple properties</h4> <p>Place your mouse cursor over the following rectangle.</p> <div class='dv1'> <div class='clsdv'></div> Some hidden text </div>
Text properties: color, font-size, font-weight, letter-spacing, line-height, text-indent, text-shadow, vertical-align, word-spacing.
Box properties: background, background-color, background-image, background-position, border-left-color etc., border-spacing, border-left-width etc., clip, crop, height, min-height, max-height, margin-left etc., opacity, outline-width, outline-offset, outline-color, padding-left etc., width, min-width, max-width.
Positioning properties: bottom, top, left, right, grid-, visibility, z-index, zoom.
<table><tr> <th>Title 1</th> <th>Title 2</th> </tr></table>
.some_class { line-height: 150%; }
document.getElementById("id_button").onclick = function(){ window.open("http://coursesweb.net/"); }
$ar_dir = scandir("dir_name"); var_export($ar_dir);