html - Animating with to zero whilst maintaining contents positioning -


i have css class designed reduce 0 width in nice animated way. works apart content (text etc) wrap new width animates , looks terrible.

how can force (in generic way, hopefully) containing div maintain contents positioning whilst animating width 0?

.highlightedsubsection.closed {     overflow:hidden;     width: 0%;     height: 0%; /* here stop text contents pushing height down width hits 0 */     opacity: 0;     -webkit-transition: .5s ease-in-out;     transition: .5s ease-in-out; } 

you can wrap .highlightedsubsection in other element , apply width animation on wrapper. need give .highlightedsubsection fixed width.

here example (hover text see animation):

.wrap p {      width:880px;      background:teal;      color:#fff;      padding:10px;  }  .wrap{      width:900px;      transition: width .5s ease-in-out;      overflow:hidden;  }  .wrap:hover{      width:0;  }
<div class="wrap">      <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. integer id libero sed nulla vestibulum eleifend. fusce mauris dui, dignissim ut sagittis ut, fringilla id nisi. integer ex erat, fermentum ac accumsan sit amet, iaculis sed urna. aenean pharetra maximus sapien id rhoncus. duis vel mauris nec ligula sodales faucibus. integer varius, erat in lobortis sollicitudin, lectus mauris elementum tortor, tincidunt elementum quam nunc sed urna. nunc sed ante tempor, commodo eros vitae, pharetra sapien. integer tortor tellus, elementum ac dapibus eu, gravida et libero. maecenas convallis augue turpis, sit amet sollicitudin nunc pretium faucibus. maecenas commodo, sem quis pretium lobortis, diam augue facilisis arcu, vitae volutpat massa turpis vitae nibh.</p>  </div>


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

How do you convert a timestamp into a datetime in python with the correct timezone? -