0

I am animating an image enclosing in a div, which moves from a <li> to some other div. The destination div contains a span having content.

What I need that, when image div appends to destination div, the all content (span text and appended img div) should be vertically centered.

var des = $(".destnation").position();   
 var el = $(".toMove");   
 el.css("position", "absolute");   
 el.animate({ top: des.top+"px" ,left :des.left+"px"}, 2000, undefined, function () {  
 el.remove().appendTo(".destnation").css("position", "static");   
 });

.destination {
   height: 4.9em;
   width: 100%;
   overflow: hidden;
   text-align: left;
   vertical-align: middle;
}

.destination span {
   color: #3366CC;
   font: 1.50em georgia, garamond, serif;
   margin-top: 0.625em;
   margin-bottom: 0.625em;
   display: block;
}
marc_s
  • 675,133
  • 158
  • 1,253
  • 1,388
RAJ
  • 9,353
  • 1
  • 29
  • 61

1 Answers1

0

HTML scales for width rather than height.

When you use vertical-align within Tables it works as you would expect. <td style="vertical-align:middle">

It will not always work correctly within regular classes.