简体   繁体   English

具有线性渐变的CSS重复图案

[英]CSS repeat pattern with linear gradient

I'm on my first approach with photoshop patterns.I'm buildin a webpage where I want to use my pattern to give a nice effect to my webpage background. 我正在使用Photoshop模式的第一种方法。我正在建立一个网页,我想使用该模式为网页背景赋予良好的效果。

The pattern I found is 120x120 px 我发现图案是120x120像素

在此处输入图片说明

If I was done here I should use this css: 如果我在这里完成,则应使用以下CSS:

background-imag:url(mypattern.jpg);
background-repeat:repeat;

But Im not done.Id like to **add to my page's background a linear gradient(dir=top/down col=light-blue/green) with the pattern fill layer on top of it, with blending mode=darken **. 但是我还没做完。我想**在我的页面背景上添加一个线性渐变(dir = top / down col = light-blue / green),并在其顶部添加图案填充层,混合模式=暗**。

This is the final effect: 这是最终效果:

在此处输入图片说明

I come to the point. 我说的很对。

QUESTION: Combining linear vertical-gradient effect and my 120x120 pattern is it possible to find a pattern that I could use to repeat itself endlessly both vertical and horizontal??which is a common solution in this case? 问题:结合线性垂直渐变效果和我的120x120图案,是否可以找到一个可以在水平和垂直方向上无休止地重复使用的图案?在这种情况下,这是常见的解决方案吗?

Hope It's clear 希望很清楚

thanks 谢谢

Luca 卢卡

or you can use background gradinent css3 或者您可以使用背景渐变CSS3

body { background: url('pattern.jpg') repeat;}
#container {
    background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(0,0,0,0) 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0)), color-stop(100%,rgba(0,0,0,1)));
    background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(0,0,0,0) 100%);
    background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(0,0,0,0) 100%);
    background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(0,0,0,0) 100%);
    background: linear-gradient(top, rgba(255,255,255,1) 0%,rgba(0,0,0,0) 100%);
}

to make it work in IE lte 7 add: 为了使其在IE Lte 7中起作用,添加:

filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#FFFFFFFF', EndColorStr='#00FFFFFF')

color is provided in #aarrggbb format, where aa=alpha(transparency), rest like normal hex color. 颜色以#aarrggbb格式提供,其中aa = alpha(transparency)与正常的十六进制颜色一样静止。

Dis will work, bg pattern with linear or radial gradient: Dis可以使用具有线性或径向渐变的bg模式:

background-image: url(images/pattern.png),  -webkit-radial-gradient(30% 40%, rgb(20,150,224), rgb(0,0,0));
    background-image: url(images/pattern.png),  -moz-radial-gradient(30% 40%, rgb(20,150,224), rgb(0,0,0));
    background-image: url(images/pattern.png),  -ms-radial-gradient(30% 40%, rgb(20,150,224), rgb(0,0,0));
    background-image: url(images/pattern.png),  -o-radial-gradient(30% 40%, rgb(20,150,224), rgb(0,0,0));
    background-image: url(images/pattern.png),  radial-gradient(circle at 30% 40%, rgb(20,150,224), rgb(0,0,0));

Apply 应用

html{
    background: url('mypattern.jpg') repeat;
}
body{
    background: url('gradient.png') repeat-x;
    width:100%;
    height:100%;
}

where gradient.png is your white gradient which becomes transparent to it's bottom. 其中gradient.png是您的白色渐变,对它的底部透明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM