曲奇饼 发表于 2019-12-17 22:05:57

CSS3种的函数,尺寸运算,属性值函数,颜色渐变函数

CSS calc() 函数定义与用法calc() 函数用于动态计算长度值。   ● 需要注意的是,运算符前后都需要保留一个空格,例如:width: calc(100% - 10px);   ● 任何长度值都可以使用calc()函数进行计算;   ● calc()函数支持 "+", "-", "*", "/" 运算;   ● calc()函数使用标准的数学运算优先级规则;
支持版本:CSS3浏览器支持表格中的数字表示支持该函数的第一个浏览器版本号。"webkit" 或 "moz" 或 "o" 指定的数字为支持该函数的第一个版本号前缀。

函数https://img.php.cn/upload/image/694/251/670/1546322463316818.gifhttps://img.php.cn/upload/image/912/807/694/1546322467179911.gifhttps://img.php.cn/upload/image/439/419/922/1546322470663741.gifhttps://img.php.cn/upload/image/305/428/459/1546322474991722.gifhttps://img.php.cn/upload/image/863/739/769/1546322488245643.gif
calc()26.0
19.0 -webkit-9.016.0
4.0 -moz-7.0
6.0 -webkit-15.0
CSS 语法
calc(expression)
值 描述
expression 必须,一个数学表达式,结果将采用运算后的返回值。


CSS attr() 函数定义与用法attr() 函数返回选择元素的属性值。
支持版本:CSS2浏览器支持
表格中的数字表示支持该函数的第一个浏览器版本号。
函数https://img.php.cn/upload/image/694/251/670/1546322463316818.gifhttps://img.php.cn/upload/image/912/807/694/1546322467179911.gifhttps://img.php.cn/upload/image/439/419/922/1546322470663741.gifhttps://img.php.cn/upload/image/305/428/459/1546322474991722.gifhttps://img.php.cn/upload/image/863/739/769/1546322488245643.gif
attr()2.03.01.03.09.0
注意: IE8 需要声明 !DOCTYPE 才可以支持 attr() 函数。CSS 语法attr(attribute-name)
值 描述
attribute-name 必须。HTML 元素的属性名。


CSS linear-gradient() 函数定义与用法linear-gradient() 函数用于创建一个线性渐变的 "图像"。为了创建一个线性渐变,你需要设置一个起始点和一个方向(指定为一个角度)的渐变效果。你还要定义终止色。终止色就是你想让Gecko去平滑的过渡,并且你必须指定至少两种,当然也会可以指定更多的颜色去创建更复杂的渐变效果。
支持版本:CSS3浏览器支持表格中的数字表示支持该函数的第一个浏览器版本号。"webkit" 或 "moz" 或 "o" 指定的数字为支持该函数的第一个版本号前缀。

函数https://img.php.cn/upload/image/694/251/670/1546322463316818.gifhttps://img.php.cn/upload/image/912/807/694/1546322467179911.gifhttps://img.php.cn/upload/image/439/419/922/1546322470663741.gifhttps://img.php.cn/upload/image/305/428/459/1546322474991722.gifhttps://img.php.cn/upload/image/863/739/769/1546322488245643.gif
linear-gradient()26.0
10.0 -webkit-10.016.0
3.6 -moz-6.1
5.1 -webkit-12.1
11.1 -o-
CSS 语法
background: linear-gradient(direction, color-stop1, color-stop2, ...);
值描述
direction用角度值指定渐变的方向(或角度)。
color-stop1, color-stop2,... 用于指定渐变的起止颜色。


CSS radial-gradient() 函数定义与用法radial-gradient() 函数用径向渐变创建 "图像"。径向渐变由中心点定义。为了创建径向渐变你必须设置两个终止色。
支持版本:CSS3浏览器支持表格中的数字表示支持该函数的第一个浏览器版本号。"webkit" 或 "moz" 或 "o" 指定的数字为支持该函数的第一个版本号前缀。
函数https://img.php.cn/upload/image/694/251/670/1546322463316818.gifhttps://img.php.cn/upload/image/912/807/694/1546322467179911.gifhttps://img.php.cn/upload/image/439/419/922/1546322470663741.gifhttps://img.php.cn/upload/image/305/428/459/1546322474991722.gifhttps://img.php.cn/upload/image/863/739/769/1546322488245643.gif
radial-gradient()26.0
10.0 -webkit-10.016.0
3.6 -moz-6.1
5.1 -webkit-12.1
11.1 -o-
CSS 语法
background: radial-gradient(shape size at position, start-color, ..., last-color);
值描述
shape确定圆的类型:    ● ellipse (默认): 指定椭圆形的径向渐变。    ● circle :指定圆形的径向渐变

size定义渐变的大小,可能值:     ● farthest-corner (默认) : 指定径向渐变的半径长度为从圆心到离圆心最远的角    ● closest-side :指定径向渐变的半径长度为从圆心到离圆心最近的边    ● closest-corner : 指定径向渐变的半径长度为从圆心到离圆心最近的角    ● farthest-side :指定径向渐变的半径长度为从圆心到离圆心最远的边

position 定义渐变的位置。可能值:     ● center(默认):设置中间为径向渐变圆心的纵坐标值。    ● top:设置顶部为径向渐变圆心的纵坐标值。    ● bottom:设置底部为径向渐变圆心的纵坐标值。

start-color, ..., last-color用于指定渐变的起止颜色。


CSS repeating-linear-gradient() 函数定义与用法repeating-linear-gradient() 函数用于创建重复的线性渐变 "图像"。
支持版本:CSS3浏览器支持表格中的数字表示支持该函数的第一个浏览器版本号。"webkit" 或 "moz" 或 "o" 指定的数字为支持该函数的第一个版本号前缀。
函数https://img.php.cn/upload/image/694/251/670/1546322463316818.gifhttps://img.php.cn/upload/image/912/807/694/1546322467179911.gifhttps://img.php.cn/upload/image/439/419/922/1546322470663741.gifhttps://img.php.cn/upload/image/305/428/459/1546322474991722.gifhttps://img.php.cn/upload/image/863/739/769/1546322488245643.gif
repeating-linear-gradient()26.0
10.0 -webkit-10.016.0
3.6 -moz-6.1
5.1 -webkit-12.1
11.1 -o-
CSS 语法
background: repeating-linear-gradient(angle | to side-or-corner, color-stop1, color-stop2, ...);
值描述
angle 定义渐变的角度方向。从 0deg 到 360deg,默认为 180deg。
side-or-corner 指定线性渐变的起始位置。由两个关键字组成:第一个为指定水平位置(left 或 right),第二个为指定垂直位置(top 或bottom)。 顺序是随意的,每个关键字都是可选的。
color-stop1, color-stop2,... 指定渐变的起止颜色,由颜色值、停止位置(可选,使用百分比指定)组成。
页: [1]
查看完整版本: CSS3种的函数,尺寸运算,属性值函数,颜色渐变函数