linear-gradient----渐变
CSS3 渐变(gradient)可以让你在两个或多个指定的颜色之间显示平稳的过渡。 以前,你必须使用图像来实现这些效果,现在通过使用 CSS3 的渐变(gradients)即可实现。此外,渐变效果的元素在放大时看起来效果更好,因为渐变(gradient)是由浏览器生成的。
1、语法
background: linear-gradient(direction, color-stop1, color-stop2, ...);
direction(角度),默认是to bottm,即从上到下的渐变。
stop,颜色的分布位置,默认是均匀分布,比如有三个颜色渐变,每个颜色的stop值为33.3%。
举个栗子:
.smallbox{
width:300px;
height:100px;
background-image:linear-gradient(to right,red,yellowgreen,blue);
}
效果:

direction的值自然还有其他三个,分别是to top 、to left 、 to bottom(默认)。
但是这仅仅是常规方向,比如你想斜着渐变,可以这样调整角度,比如从左上角向右下角渐变,可以:
.smallbox{
width:300px;
height:100px;
background-image:linear-gradient(to right bottom,red,yellowgreen,blue);
}
效果:

类似值,还有,to right top、to left top、to left bottom。
可以使用具体角度值表示角度,单位deg:

举个栗子,比如90deg(也就是to right):
.smallbox{
width:300px;
height:100px;
background-image:linear-gradient(90deg,red,yellowgreen);
}
效果:

重复性渐变:repeating-linear-gradient
.smallbox{
width:300px;
height:100px;
background-image: repeating-linear-gradient(90deg,red 10%,yellowgreen 20%);
}
效果:

渐变到透明:rgba
.smallbox{
width:300px;
height:100px;
background-image: linear-gradient(to right, rgba(255, 0 ,0, 1), rgba(255, 0 ,0 , 0));
}
效果:

linear-gradient----渐变的更多相关文章
- CSS3 Gradient 渐变
转载自:http://www.w3cplus.com/content/css3-gradient CSS3发布很久了,现在在国外的一些页面上常能看到他的身影,这让我羡慕已久,只可惜在国内为了兼容IE, ...
- FCC---Create a Gradual CSS Linear Gradient
Applied Visual Design: Create a Gradual CSS Linear Gradient background: linear-gradient(gradient_dir ...
- CSS 3 属性学习 —— 1. Gradient 渐变
CSS3 中渐变分为: 线性渐变(linear-gradient)和径向渐变(radial-gradient)两种. 1. 线性渐变 参数: <linear-gradient> = li ...
- gradient渐变IE兼容处理
根据caniuse(http://caniuse.com/#search=gradient),rgba兼容性为IE10以及以上浏览器. 实例代码: <!doctype html> < ...
- CSS gradient渐变之webkit核心浏览器下的使用以及实例
一.关于渐变 渐变是一种应用于平面的视觉效果,可以从一种颜色逐渐地转变成另外一种颜色,故可以创建类似于彩虹的效果渐变可以应用在任何可以使用图片的地方.例如,您可以指定一个这么一个渐变:顶部的颜色是红色 ...
- CSS gradient渐变之webkit核心浏览器下的使用
一.关于渐变 渐变是一种应用于平面的视觉效果,可以从一种颜色逐渐地转变成另外一种颜色,故可以创建类似于彩虹的效果渐变可以应用在任何可以使用图片的地方.例如,您可以指定一个这么一个渐变:顶部的颜色是红色 ...
- gradient 渐变
看了大漠 写的关于 Gradient 的文章,我也想写点以便加深记忆. 首先gradient 分为linear-gradient (线性渐变) 和 radial-gradient(径向渐变),渐变是作 ...
- CSS3 Gradient 渐变还能这么玩
浏览器支持两种类型的渐变:线性渐变 (linear-gradient),径向渐变 (radial-gradient) 渐变在 CSS 中属于一种 Image 类型,可以结合 background-im ...
- java实现渐变效果工具
[html] view plain copy package gradient; import java.awt.Color; import java.awt.Dimension; import ja ...
- css 条纹背景
先介绍文章用到的二个知识点 background-size 属性 语法 background-size: length|percentage|cover|contain; css线性渐变 linear ...
随机推荐
- Pyqt+QRcode 生成 识别 二维码
1.生成二维码 python生成二维码是件很简单的事,使用第三方库Python QRCode就可生成二维码,我用Pyqt给QRcode打个壳 一.python-qrcode介绍 python-qrco ...
- 【leetcode】Search Insert Position
题目描述: Given a sorted array and a target value, return the index if the target is found. If not, retu ...
- Javascript中的apply与call详解
JavaScript中有一个call和apply方法,其作用基本相同,但也有略微的区别. 一.方法定义 1.call 方法 语法:call([thisObj[,arg1[, arg2[, [,.arg ...
- 如何在本地搭建IIS服务器
http://jingyan.baidu.com/article/8ebacdf021313d49f65cd525.html
- PHP require和include的区别
require一个文件存在错误的话,那么程序就会中断执行了,并显示致命错误 include一个文件存在错误的话,那么程序不会中端,而是继续执行,并显示一个警告错误. 以下为补充:1. include有 ...
- Jquery利用Iframe实现跨子域
cross_sub.html <!DOCTYPE html> <html lang="en"> <head> <meta charset= ...
- 分布式缓存技术memcached学习(四)—— 一致性hash算法原理
分布式一致性hash算法简介 当你看到“分布式一致性hash算法”这个词时,第一时间可能会问,什么是分布式,什么是一致性,hash又是什么.在分析分布式一致性hash算法原理之前,我们先来了解一下这几 ...
- 清华学堂 LightHouse
灯塔(LightHouse) Description As shown in the following figure, If another lighthouse is in gray area, ...
- div可编辑状态设置
<div contentedittable="ture"></div>
- 一言不合敲代码(1)——DIV+CSS3制作哆啦A梦头像
先展示一下我的头像吧. 作为一个前端ER,我的头像当然不能是绘画工具画出来的.没错,这个玩意是由HTML+CSS代码实现的,过年的某一天晚上无聊花了一个小时敲出来的.来看看它原本的样子: 为什么会变成 ...