Reputation: 14348
I want to maintain the position of the text but when hovered on the div, the text goes down
html
<!DOCTYPE html>
<html>
<head>
<link href="site.css" rel="stylesheet" type="text/css" media="screen"/>
</head>
<body>
<div></div>
<p>hover over the div element above, and the text goes down</p>
</body>
</html>
CSS
div {
width: 100px;
height: 100px;
background: red;
-webkit-transition: height 1s;
}
div:hover {
height: 300px;
}
Upvotes: 1
Views: 56
Reputation: 15699
Add following to your css:
p {
position:absolute;
top:100px;
}
Upvotes: 2