Add a 2 second transition effect for background, and transform changes of the <div> element. - HTML CSS CSS

HTML CSS examples for CSS:Quiz

Description

Add a 2 second transition effect for background, and transform changes of the <div> element.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
div {<!--from  w  w  w. j a v a2 s. c o m-->
    width: 100px;
    height: 100px;
    background: red;
    transition: background 2s, transform 2s;
}

div:hover {
    background: blue;
    transform: rotate(180deg);
}
</style>
</head>
<body>
<div></div>

<p>Hover over the div element above.</p>

</body>
</html>

Related Tutorials