过渡:宽度改变方向

San*_*ngh 3 css3

CSS3属性的默认方向transition: width 1s是从左到右增加宽度.

怎么可能从右到左反转方向?CSS3有可能吗?还是需要一些其他jQuery插件?请看一下演示小提琴.按下按钮时,宽度从左向右增加.我想扭转这种局面.

Ita*_*tay 5

一种方法是将它们放在一个right对齐的容器中.

jsFiddle演示

HTML:

<div>
    <input type='text'> </input>
    <button> increase width </button>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

div {    
    text-align: right;
    width: 450px;
}
Run Code Online (Sandbox Code Playgroud)