我正在尝试添加转换,但它不起作用 我添加了转换到我的链接并期望更改悬停状态 我使用过渡很多,但有时这发生在我身上,我不知道为什么这个属性不起作用 我更愿意知道为什么它不起
我添加了转换到我的链接并期望更改悬停状态
我使用过渡很多,但有时这发生在我身上,我不知道为什么这个属性不起作用
我更愿意知道为什么它不起作用
这是我的代码
<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>
和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
一个简单的错误:-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;
改成:
-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;
演示:http://jsfiddle.net/X5UBF/1/
转换值不以逗号分隔.它们是一个单一的声明.如果要声明多个转换,那么您可以用逗号分隔它们.
见W3C Docs或/和CSS3.info
Value: <single-transition> [ ‘,’ <single-transition> ]*
其中<单转换>是:
<single-transition> = <transition-property> <transition-duration> <transition-timing-function> <transition-delay>
因此,逗号分隔的示例将是:
transition: opacity 0.5s ease-in, width 1.5s ease-out; /* 0.5s for an opacity transform while 1.5s for a width transform */