1 reply [Last post]
shokoaviv
shokoaviv's picture
Offline
newbie
Last seen: 26 weeks 5 days ago
Timezone: GMT+2
Joined: 2017-01-10
Posts: 1
Points: 2

Hi everybody!

I'm trying to increase the size of a div from 200px to 400px but in an upward direction and not downward. Any idea how to do this using CSS? I've attached the CSS that I've written so far.

div1 {
border: 5px solid red;
position: absolute;
width: 100px;
height:200px;
left: 0;
top: 100px;
transition: height .5s;
}
div1:hover {
height:400px;

}

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 3 hours 32 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9634
Points: 3702

Without my knowing the page, this is subject to failure

div1:hover {
    height:400px;
    top: -100px;
    }

You do know there is no element "div1", right?

The use of the position property puts you in the swamp, up to your ass in alligators, if you are not well versed in its use.

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.