Raj*_*Raj 10 css google-chrome linear-gradients css3
经过大量的搜索后,我遇到了线性渐变问题,它适用于Firefox但不适用于Chrome.
我-webkit-
在线性渐变之前添加了如一个参考文献中所描述但仍然不起作用我认为问题出在渐变轴上
我的代码
<nav class="top_menu">
<ul class="black_high">
<li class="first active"> <a href="#">Home</a>
</li>
<li> <a href="#">news</a>
</li>
</ul>
</nav>
Run Code Online (Sandbox Code Playgroud)
.top_menu ul li.active a::after {
position: absolute;
bottom: 8px;
left: 0;
width: 100%;
height: 2px;
transform:none;
content: '';
opacity: 1;
background: #fff;
background: linear-gradient(left, transparent 0%,#fff 50%,transparent 100%);
background: -moz-linear-gradient(left, transparent 0%,#fff 50%,transparent 100%);
background: -webkit-gradient(left, transparent 0%,#fff 50%,transparent 100%);
}
Run Code Online (Sandbox Code Playgroud)
在这里创造一个小提琴 - http://jsfiddle.net/h2zu5xx2/4/
任何提示/建议都会很棒.提前致谢.
Has*_*ami 17
首先要注意的是,这-webkit-gradient
是Apple打算在2008年在基于Webkit的Web浏览器(例如Safari 4)中实现的,它的语法与W3C标准完全不同:
-webkit-gradient(<type>, <point> [, <radius>]?, <point> [, <radius>]? [, <stop>]*)
Run Code Online (Sandbox Code Playgroud)
例如:
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#87e0fd), color-stop(40%,#53cbf1), color-stop(100%,#05abe0));
Run Code Online (Sandbox Code Playgroud)
这就是为什么你不能让它在你的情况下工作.
一年后,Mozilla推出了-moz-linear-gradient
(自Firefox 3.6以来),它的语法与旧的Webkit版本不同,但后来在Webkit中实现-webkit-linear-gradient
:
-moz-linear-gradient([ [ [top | bottom] || [left | right] ],]? <color-stop>[, <color-stop>]+)
Run Code Online (Sandbox Code Playgroud)
但是W3C标准版的linear-gradient
安静性不同,linear-gradient()
表达式的正式语法是:
linear-gradient() = linear-gradient(
[ <angle> | to <side-or-corner> ]? ,
<color-stop-list>
)
<side-or-corner> = [left | right] || [top | bottom]
Run Code Online (Sandbox Code Playgroud)
从您发布的代码中可以看出,另一个错误是to <side>
W3C版本缺乏.因此,在您的情况下,它应该是:
background: -webkit-gradient(linear, left top, right top, color-stop(0%, transparent), color-stop(50%,#fff), color-stop(100%,transparent)); /* Chrome, Safari4+ */
background: -webkit-linear-gradient(left, transparent 0%,#fff 50%,transparent 100%); /* Chrome10+, Safari5.1+ */
background: -moz-linear-gradient(left, transparent 0%,#fff 50%,transparent 100%); /* FF3.6+ */
background: linear-gradient(to left, transparent 0%,#fff 50%,transparent 100%); /* W3C */
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
30024 次 |
最近记录: |