html - CSS transition 0s (zero seconds) not working? -


i want avoid of transition effects on element (for example: opacity). should use opacity 0s, because should default value or in other words transition have no effect on this. it's not working way. tried:

div {      width: 100px;      height: 100px;      opacity: 0.5;      background: red;      -webkit-transition: 2s, opacity 0s;      transition: 2s, opacity 0s;  }    div:hover {      width: 300px;      opacity: 1;  }      
<div></div>

div {      width: 100px;      height: 100px;      opacity: 0.5;      background: red;      -webkit-transition: 2s, opacity 0.1s;      transition: 2s, opacity 0.1s;  }    div:hover {      width: 300px;      opacity: 1;  }      
<div></div>

however, if 0s of opacity changed 0.1s, work(with duration of 0.1s), there way "disable" animation in other way, perhaps, work without small value 0.1s?

here solution this

transition: 2s, opacity 1ms;

as 0s not valid time (i don't know why this). , 1ms small time 0s human eye.

and current problem can use transition: width 2s applicable width.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -