Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why css transition doesn't work

I'm trying to add transition but it doesnt work I added transition to my links and expect changes on hover state I used transition alot, but some times this happens to me and I dont know why this property doesnt work

I prefer to know why it doesnt work

this is my code

<div class="subNavigation">
                        <ul>
                            <li>درباره بانک مهر</li>
                            <li><a href="javascript:void(0)">درباره بانک مهر 1</a></li>
                            <li><a href="javascript:void(0)">درباره بانک مهر 2</a></li>
                            <li><a href="javascript:void(0)">درباره بانک مهر 3</a></li>
                            <li><a href="javascript:void(0)">درباره بانک مهر 4</a></li>
                        </ul>
                    </div>

and css

.subNavigation {
 width: 900px;
 height: 274px;
 position: absolute;
 top: 40px;
 right: 0;
 padding: 30px 60px 0 0;
 }
 /* line 126, ../sass/style.scss */
 .subNavigation ul {
 float: right;
 }
 /* line 130, ../sass/style.scss */
 .subNavigation li {
 width: 153px;
 *zoom: 1;
 margin-top: 4px;
 padding-right: 2px;
 padding-bottom: 4px;
 border-bottom: 1px dotted #b4b4b4;
 }
 /* line 38, D:/Ruby193/lib/ruby/gems/1.9.1/gems/compass-      0.12.2/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss */
.subNavigation li:after {
 content: "";
 display: table;
 clear: both;
 }
/* line 138, ../sass/style.scss */
.subNavigation li:first-child {
width: 155px;
height: 24px;
margin-top: 0;
margin-bottom: 14px;
color: #f7931e;
border-bottom: 1px solid #dddddd;
padding-right: 0;
font-size: 16px;
line-height: 24px;
}
/* line 151, ../sass/style.scss */
 .subNavigation a {
  float: right;
  font-size: 13px;
   height: 24px;
   line-height: 24px;
   padding-right: 2px;
  color: #222;
  -webkit-transition: all, 0.2s, ease-in;
  -moz-transition: all, 0.2s, ease-in;
  -o-transition: all, 0.2s, ease-in;
   transition: all, 0.2s, ease-in;
   }
  /* line 160, ../sass/style.scss */
 .subNavigation a.eng {
  font-family: tahoma;
  }
 /* line 164, ../sass/style.scss */
 .subNavigation a:hover {
  padding-right: 10px;
  border-right: 4px solid #f7941d;
  color: #19ae61;
  }

The Fiddle

like image 343
Kamran Asgari Avatar asked Dec 11 '22 14:12

Kamran Asgari


2 Answers

One simple error:

-webkit-transition: all, 0.2s, ease-in;
-moz-transition: all, 0.2s, ease-in;
-o-transition: all, 0.2s, ease-in;
transition: all, 0.2s, ease-in;

Change to:

-webkit-transition: all 0.2s ease-in;
-moz-transition: all 0.2s ease-in;
-o-transition: all 0.2s ease-in;
transition: all 0.2s ease-in;

Demo: http://jsfiddle.net/X5UBF/1/

Transition values are not comma separated. They are a single declaration. If you want to declare multiple transitions, THEN you comma separate them.

See W3C Docs or/and CSS3.info

Value: <single-transition> [ ‘,’ <single-transition> ]*

Where <single-transition> is:

<single-transition> = <transition-property> <transition-duration> <transition-timing-function> <transition-delay>

So, a comma separated example would be:

transition: opacity 0.5s ease-in, width 1.5s ease-out;
/* 0.5s for an opacity transform while 1.5s for a width transform */
like image 96
RaphaelDDL Avatar answered Dec 24 '22 09:12

RaphaelDDL


Improper declaration of transition:

 -webkit-transition: all 0.2s ease-in;  /* Chrome 1-25, Safari 3.2+ */
 -moz-transition: all 0.2s ease-in;  /* Firefox 4-15 */
 -o-transition: all 0.2s ease-in;  /* Opera 10.50–12.00 */
 transition: all 0.2s ease-in;  /* Chrome 26, Firefox 16+, IE 10+, Opera 12.10+ */
like image 33
David Nguyen Avatar answered Dec 24 '22 09:12

David Nguyen