html - 从服务器颜色时如何应用渐变效果

标签 html css

我做了一个按钮:

<div class="pl-menu">

    <ul id="save-button"><li style="background-color:black" onClick="">SAVE</li></ul>

</div>

这是 CSS:

.pl-menu {

color: #FFF;
text-transform: uppercase;
margin-top: 0px;
text-align: center;
font-size: 18px;
border: 1px solid #ffffff;
width:350px;
}

.pl-menu ul{

height:inherit;

}

 .pl-menu ul li {

list-style-type: none;
height: inherit;
text-align: center;
height: 45px;
border: 0.2px solid #ffffff;
}

这是 fiddle 链接:example

出于某种原因,我不得不使用这个 html ul 和 li 代码来制作这个按钮。

现在我想实现如下效果:

1) 使按钮看起来更坚固,如下所示:

enter image description here

2) 当用户点击按钮时,按钮看起来“淡出”

enter image description here

问题:

a) 我想知道,我可以应用什么 CSS 技术使按钮看起来更像图像 1 一样

b) 我可以应用什么 CSS 技术来使它看起来“淡化”。 (我试过不透明度:0.8,但这不是我要找的)。

=======更新=============

box-shadow:inset 适合我。

最佳答案

如果你想制作渐变,但颜色来自服务器,你可以使用嵌入阴影,半透明的白色逐渐消失::

.pl-menu ul li {

    list-style-type: none;
    text-align: center;
    border: 1px solid #ffffff;

    height: auto;
    width: 100%;
    padding: 10px 0px;

    box-shadow: inset 0px 15px 25px rgba(255,255,255, 0.5);
    -webkit-animation: colors 4s infinite;
    animation: colors 4s infinite;

}

在此fiddle我在背景色上设置了一个动画,只是为了表明光效与背景色无关

关于html - 从服务器颜色时如何应用渐变效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21540304/

相关文章:

c# - 根据 HTML 页面上的位置对 HtmlNode 进行排序 (C#/XPath)

html - 在Perl CGI中正确编程/从不同的perl cgi文件访问相同的数据

jquery - 如何(i)将过渡添加到 jQuery Slider 和(ii)使 slider 响应?

html - 如何在 CSS/HTML 中为任意内容定义一个矩形框?

html - 如何删除弹出窗口覆盖和链接中的多余空白

html - 使用一个 org-mode 文件创建多页面网站

css - 使用 Jquery Ui - 在特定的多选框上设置宽度

html - CSS垂直对齐和 float 问题

javascript - 反击两个不同的 div 并隐藏 prepend() 函数

javascript - .append() 将图像 append 到过渡非常慢