0

我被赋予了重新创建以下菜单的任务:

在此处输入图像描述

我只是不确定如何创建渐变。完毕

为什么在我的代码中看不到它?http://jsfiddle.net/Vtr6d/

目前我有:

CSS:

.mainOptions{
    float:left;
    margin:0 20px 0 20px;
    color:#fff;
    width:500px;
    height:50px;
    background:gray;
}
.mainOptions .composer{
    width:50px;
    height:40px;
    background:-webkit-gradient(linear, 0 0, 0 100%, from(#184C82), to(#022243));
}
.mainOptions .composerIcon{
    display:inline-block;
    width:14px;
    height:14px;
    background:url('../images/composer.png') no-repeat -96px -72px;
}
.mainOptions ul li{
    display:inline-block;
    padding:4px 10px 4px;
    border-radius:4px;
}
.mainOptions li a{
    text-decoration:none;
    font-size:13px;
    line-height:18px;
    text-align:center;
    vertical-align:middle;
}
.mainOptions li{
    width:140px;
    background-color:pink;
}

HTML:

<nav class="mainOptions">
                <ul>
                    <li class="composerIcon composer"><a href="#" style="margin-top: 2px; padding-top: 5px; padding-bottom: 5px;">Composer</a></li>
                    <li><a href="#">Address Books</a></li>
                    <li class="active"><a href="#" target="_self" title="View Messages Scheduled for Future Delivery">Scheduled Messages</a></li>
                    <li><a href="#" target="_self" title="Message Templates for you or your organisation">Templates</a></li>
                </ul>
            </nav>
4

3 回答 3

1

试试这个在所有浏览器中工作。

background: #184c82; /* Old browsers */
background: -moz-linear-gradient(top,  #184c82 0%, #022243 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#184c82), color-stop(100%,#022243)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  #184c82 0%,#022243 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  #184c82 0%,#022243 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  #184c82 0%,#022243 100%); /* IE10+ */
background: linear-gradient(top,  #184c82 0%,#022243 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#184c82', endColorstr='#022243',GradientType=0 ); /* IE6-9 */
于 2012-05-29T09:42:55.000 回答
0
background-image:       -webkit-linear-gradient(linear,0%,0%,0%,100%,from(#3388FF),to(#296DCC));
background-image:       -webkit-linear-gradient(top,#3388FF,#296DCC);
background-image:       -ms-linear-gradient(top,#3388FF,#296DCC);
background-image:       -o-linear-gradient(top,#3388FF,#296DCC);
background-image:       -moz-linear-gradient(top,#3388FF,#296DCC);
background-image:       linear-gradient(top,#3388FF,#296DCC);

对于浏览器兼容性问题,请使用所有这些

于 2012-05-28T20:08:41.697 回答
0

使用梯度生成器?http://gradients.glrzad.com/

您也可以手动执行此操作:

background-image: linear-gradient(bottom, <color1> 5%, <color2> 53%, <color3>  77%);
background-image: -o-linear-gradient(bottom, <color1> 5%, <color2> 53%, <color3> 77%);
background-image: -moz-linear-gradient(bottom, <color1> 5%, <color2> 53%, <color3> 77%);
background-image: -webkit-linear-gradient(bottom, <color1> 5%, <color2> 53%, <color3> 77%);
background-image: -ms-linear-gradient(bottom, <color1> 5%, <color2> 53%, <color3> 77%);

background-image: -webkit-gradient(
    linear,
    left bottom,
    left top,
    color-stop(0.05, <color1>),
    color-stop(0.53, <color2>),
    color-stop(0.77, <color3>)
);

<color1>,<color2><color3>三种rgb(x,y,z)颜色。您还可以编辑百分比以满足您的需要。

于 2012-05-28T20:10:59.217 回答