Add a 2 second transition effect for width changes of the <div> element. - HTML CSS CSS

HTML CSS examples for CSS:Quiz

Description

Add a 2 second transition effect for width changes of the <div> element.

Demo Code

ResultView the demo in separate window

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

div:hover {
    width: 300px;
}
</style>
</head>
<body>

<div></div>

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

</body>
</html>

Related Tutorials