Issue with Div Animation
I am currently facing an issue where I am trying to animate a div to expand to 100% of its child's width on hover. However, the animation is not working smoothly as expected. Instead of gradually expanding to the right, the div is abruptly shifting. Can anyone identify why the animation is not behaving correctly? I would like to achieve this effect without using JavaScript if possible.
My Code Attempt
I have replicated the code from the following fiddle:
http://jsfiddle.net/tVHYg/1662/
and implemented it in the source below:
.contents {
white-space:nowrap;
display:inline-block;
}
.inner {
background:#c3c;
width: 100%;
max-width:50px;
overflow:hidden;
transition: all .3s ease-in-out;
padding: 5px 0 5px 0;
}
.contents:hover .inner {
max-width:100%;
}
<div class="contents">
<div class="inner">A bit of text never hurt anyone</div>
</div>
<div class="contents">
<div class="inner">A bit of text never hurt anyone</div>
</div>