html - 如何淡化渐变、图像或纹理作为背景?

标签 html css

对 css 和 html 以及使用 html5/css3 页面非常陌生。

如何应用类似于以下的渐变或图像(是图像还是纹理)并相应地在页面上淡化?

enter image description here

我一直在尝试类似的渐变,但似乎只适用于颜色,而不适用于网格/格栅效果。

        background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.65)), color-stop(100%,rgba(0,0,0,0)));  

谢谢

最佳答案

使用这段代码,

    <div class="grilleLayer"><div>

    .grilleLayer
    {
        width:100%;
        height:700px;
    background:url('http://s8.postimg.org/90qdtbn1t/temp.png') repeat scroll left top; 
    }


    body
    {
    background: #e0e5e1; /* Old browsers */
    background: -moz-linear-gradient(left, #e0e5e1 0%, #ffffff 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, right top, color-stop(0%,#e0e5e1), color-stop(100%,#ffffff));         /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(left, #e0e5e1 0%,#ffffff 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(left, #e0e5e1 0%,#ffffff 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(left, #e0e5e1 0%,#ffffff 100%); /* IE10+ */
    background: linear-gradient(to right, #e0e5e1 0%,#ffffff 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e0e5e1', endColorstr='#ffffff',GradientType=1 ); /* IE6-9 */
    }

这里是 Fiddle !

你可以生成你想要的渐变色HERE

关于html - 如何淡化渐变、图像或纹理作为背景?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17312809/

相关文章:

c# - CSS 标题位置固定删除间距

html - 有没有一种方法可以自动正确调整我的 html/css 网页的大小?

javascript - 将字符串附加到具有相同类名的元素

php - 如何安全地处理进出数据库的文本区域数据?

javascript - 更改div的滚动条颜色

php - 使用 php 显示文本和 html

javascript - 从 CSS 属性设置 Canvas strokeStyle 颜色?

javascript - 使用 JavaScript 获取选定文件的名称

javascript - 单击子菜单未打开页面它隐藏了 HTML 中的子菜单

html - Flexbox 等高列