1

Very new to css and html and using html5/css3 pages.

How can I apply a gradient or image similar to the following (is that an image or texture) and fade it down the page accordingly?

enter image description here

I have been trying similar gradients like this but seems to only apply to color and not a grid/grille effect.

        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)));  

thx

4

2 回答 2

1

使用此代码,

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

这是小提琴

或者

你可以在这里生成你想要的渐变颜色

于 2013-06-27T06:58:16.623 回答
1

可以在包装 div 上使用二级渐变来实现网格效果,并带有非常小的色标。这是一个例子

body
{
    background: linear-gradient(135deg, rgba(0,0,0,0.65) 0,rgba(0,0,0,0) 1px);
    background-size: 2px 2px;
}

不过,我会坚持使用小纹理,并使用 CSS 渐变作为主要背景,因为与 CSS 渐变相比,您可以更好地控制纹理图像(尤其是您想要的图案通常需要像素-完美的)。

于 2013-06-27T06:38:08.877 回答