html - div底部的渐变不透明度

标签 html css gradient opacity

我想在这张图片上创建效果 - 内容底部的渐变不透明度: opacity

我该怎么做?

最佳答案

你可以使用这个 HTML

<div class="content">
    Loriem ispsum is simply dummy text<br>
    Loriem ispsum is simply dummy text<br>
    Loriem ispsum is simply dummy text<br>
    Loriem ispsum is simply dummy text<br>
    Loriem ispsum is simply dummy text<br>
    Loriem ispsum is simply dummy text<br>
    Loriem ispsum is simply dummy text<br>
    Loriem ispsum is simply dummy text<br>
    Loriem ispsum is simply dummy text<br>
    Loriem ispsum is simply dummy text<br>
    Loriem ispsum is simply dummy text<br>
    Loriem ispsum is simply dummy text<br>
    Loriem ispsum is simply dummy text<br>


     <div class="gradientback">

     </div>
</div>

使用这个 CSS

body{background:#000;}
.content{
    width:500px;
    height:300px;
    position:relative;
    color:#fff;
    overflow:hidden;
}
.gradientback{

    position:absolute;
    bottom:0px;
    left:0px;
    width:100%;
    height:50px;
    background: -moz-linear-gradient(top,  rgba(137,255,241,0) 0%, rgba(0,0,0,1) 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(137,255,241,0)), color-stop(100%,rgba(0,0,0,1))); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  rgba(137,255,241,0) 0%,rgba(0,0,0,1) 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  rgba(137,255,241,0) 0%,rgba(0,0,0,1) 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  rgba(137,255,241,0) 0%,rgba(0,0,0,1) 100%); /* IE10+ */
    background: linear-gradient(to bottom,  rgba(137,255,241,0) 0%,rgba(0,0,0,1) 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0089fff1', endColorstr='#000000',GradientType=0 ); /* IE6-9 */

}

这里是 jsfiddle link

关于html - div底部的渐变不透明度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18651345/

相关文章:

javascript - 浏览器无法识别 javascript/jquery 代码

jquery - 在 HTML5 Canvas 上绘制并获取坐标

css - 2列 float 浪费空间

jquery - jQuery 幻灯片中的渐变不保持原样?

c# - 如何在 Windows 窗体 C# 中为文本框提供渐变颜色

html - 渐变混合多个图像

javascript - div slider 不工作

html - 如何将元素完美地嵌入到另一个元素中?

html - WordPress 'Contact Form 7' 表单生成不一致的字段

css - 给出没有类特定样式的 anchor 元素