I want to change the height growth path of Top-down to Down-top
Is it possible in CSS?
this is my code
http://jsfiddle.net/yasharshahmiri/1pkemq1p/3/
.buttom{
margin-top:200px;
margin-right:34px;
width:150px;
height:45px;
background:black;
float:right;
transition-duration:2s; }
.buttom:hover{
height:180px;
transition-duration:2s;}
You have to set
absolute
position to the<div>
.@PlantTheIdea (nice name) had the answer. It's caveat (absolute positioning) is a pretty big one, depending on your layout, but here's how it works:
You can do a smart trick: change
margin-top
simultaneously with height so that it looks like height is growing from bottom to top:Final
margin-top
(65px) is the difference of the startingmargin-top
(200) and diff of the resulting (180px) and initial (45px) height: 65 = 200 - (180 - 45). In this case block will visually stay fixed while growing up.Demo: http://jsfiddle.net/1pkemq1p/6/
All you need is to set
position: absolute
andbottom
position like this:Use Rotate and transform-origin to be able to set position relative to the element
Or this way: