Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html CSS3菜单布局和渐变未显示_Html_Css_Gradient - Fatal编程技术网

Html CSS3菜单布局和渐变未显示

Html CSS3菜单布局和渐变未显示,html,css,gradient,Html,Css,Gradient,我的任务是重新创建以下菜单: 我只是不知道如何创建渐变完成 为什么我不能在代码中看到它 目前我有: CSS: .mainOptions{ float:left; margin:0 20px 0 20px; color:#fff; width:500px; height:50px; background:gray; } .mainOptions .composer{ width:50px; height:40px; back

我的任务是重新创建以下菜单:

我只是不知道如何创建渐变完成

为什么我不能在代码中看到它

目前我有:

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;
}
<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>
HTML:

.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;
}
<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>


对于浏览器兼容性问题,请全部使用是否使用渐变生成器

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

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>)
);
背景图像:线性梯度(底部,5%,53%,77%);
背景图像:-o-线性梯度(底部,5%,53%,77%);
背景图像:-莫兹线性梯度(底部,5%,53%,77%);
背景图像:-webkit线性渐变(底部,5%,53%,77%);
背景图像:-ms线性梯度(底部,5%,53%,77%);
背景图像:-webkit渐变(
线性的
左下角,
左上角,
色差(0.05,),
彩色光圈(0.53,),
颜色停止(0.77,)
);

使用
三种
rgb(x,y,z)
颜色。您还可以编辑百分比以满足您的需要。

在所有浏览器中尝试此操作

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 */