I have a problem with css animation.
In my case I have table with 2 languages. On language hover, I want the table to extend to full width of the table... current code works only on first language... If I hover over second element the cell only strutters, it doesn't extend to left direction.
Here's a snippet
.locale-wrapper {
width: 80px;
height: 40px;
}
.locale-text {
vertical-align: middle;
text-align: center;
border: 1px solid black;
font-size: 16px;
width: 50%;
-webkit-transition: all .5s;
-moz-transition: all .5s;
-o-transition: all .5s;
transition: all .5s;
transition-timing-function: ease-in-out;
-moz-transition-timing-function: ease-in-out;
-webkit-transition-timing-function: ease-in-out;
-o-transition-timing-function: ease-in-out;
}
.locale-text:hover {
width: 100%;
}
<table class="locale-wrapper">
<tr>
<td class="locale-text">SL</td>
<td class="locale-text">EN</td>
</tr>
</table>
If you fix the size of your table
to 80px
and your td
width to 50%
you know that there's only two cell then use 40px
instead of 50%
it doesn't work on the second cause the first try to keep his 50%
of width
. And fix your :hover
width in px
too.
Working example :
.locale-wrapper {
width: 80px;
height: 40px;
}
td.locale-text{
vertical-align: middle;
text-align: center;
border: 1px solid black;
font-size: 16px;
width: 40px;
-webkit-transition: all .5s;
-moz-transition: all .5s;
-o-transition: all .5s;
transition: all .5s;
transition-timing-function: ease-in-out;
-moz-transition-timing-function: ease-in-out;
-webkit-transition-timing-function: ease-in-out;
-o-transition-timing-function: ease-in-out;
}
td.locale-text:hover {
width: 80px;
}
<table class="locale-wrapper">
<tr>
<td class="locale-text">SL</td>
<td class="locale-text">EN</td>
</tr>
</table>