背景

作者: cooore | 来源:发表于2016-07-01 22:47 被阅读0次

background-color:<color>

background-image:<bg-image>[,<bg-iamge>]*

<bg-image> = <image>|none

url("/image/x.png")

background-image:url(red.png),url(blue.png);

background-repeat:<repeat-style>[,<repeat-style>]*

<repeat-style> = repeat-x|repeat_y|[repeat|space|round|no-repeat]{1,2}

background-repeat:no-repeat repeat;对应x、y

background-attachment:<attachment>[,<attachment>]*

<attachment> = scroll(背景不动) | fixed|lacal(内容和背景一起滚动)

background-position:<position>[,<position>]*

background-position:0 0; 对应X轴和Y轴

background-position:10px 20px;

background-position:20% 50%; 图片百分比的位置和容器百分比的位置对应

background-position:50% 50%; 居中

background-position:center center; 居中

background-position:right X轴最右边 另外一个值默认center

background-position:right 10px top 20px;

精灵图片

线性渐变linear-gradient

[[<angle>|to <side-or-corner>],]?<color-stop>[,<color-stop>]+

<side-or-corner> = [left|right|top|bottom]

<color-stop> = <color>[<percentage>|<length>]?

background-image:linear-gradient(red,blue);默认上到下

background-image:linear-gradient(to top,red,blue);下到上

background-image:linear-gradient(to right bottom,red,blue);左上到右下

background-image:linear-gradient(0deg,red,blue);从下往上

background-image:linear-gradient(45deg,red,blue);从左下往右上

background-image:linear-gradient(red,green,blue);从下往上

background-image:linear-gradient(red,green 20%,blue);从下往上

镜像渐变:radial-gradient()

[[circle||<length>][at <position>]?,| 可以设置一个圆形,并且可以设置大小即半径,圆心位置

[ellipse||<length>|<percentage>]{2}][at <position>]?,| 可以设置一个椭圆,并且可以设置大小即半径两个值,圆心位置

[[circle|ellipse]||<extent-keyword>][at <position>]?,|at<position>,]?<color-stop>[,<color-stop>]+

<extent-keyword> = closest-side|farthest-side|closest-corner|farthest-corner

background-image:radial-gradient(closest-side,red,blue);

background-image:radial-gradient(circle,red,blue);

background-image:radial-gradient(circle 100px,red,blue);

background-image:radial-gradient(red,blue);

background-image:radial-gradient(100px 50px at 0 0,red,blue);

repeat-*-gradient

background-origin 决定的是背景图(0,0)(100%,100%)区域

<box>[,<box>]*

<box> = border-box|padding-box(默认值)|content-box

background-clip 裁剪

<box>[,<box>]*

<box> = border-box(默认值)|padding-box|content-box

background-size 大小

<bg-size>[,<bg-size>]*

<bg-size> = [<length>|<percentage>|auto]{1,2}|cover|contain

background

[<bg-layer>,]*<final-bg-layer>

<bg-layer> = <bg-image>||<position>[/<bg-size>]?||<repeat-style>||<attachment>||<box>||<box>

<final-bg-layer> = <bg-layer>||<'background-color'>

background:url(red.png) 0 0/20px 20px no-repeat,url(blue.png) 50% 50%/contain no-repeat content-box green;

在低版本浏览器(如IE6、IE7、IE8等)中不支持,比如:多背景图、渐变背景、background-size、background-origin、background-clip等。

相关文章

  • CSS条纹背景,点阵背景,圆点背景。

    1、背景图片 废话不多说,上代码: 效果图如下: 投影:box-shadow: X坐标/ Y坐标/ 模糊/ 扩展/...

  • 背景

    当今世界,不得不说网络媒体的力量确实强大。最近几天网上在热传一则消息,浙江温州一对高颜值双胞胎姐妹双双...

  • 背景

    这个城市的高楼不断的在推陈出新,这个城市的房价不断的在节节攀升,这个城市的人口不断的在膨胀增长,这是我们所了解到的...

  • 背景

    设置背景样式:backgrou-color: #bfa;设置背景图片;使用background-image来设置背...

  • 背景

    背景: 图片做背景,background-image:url(img/**.ipg 相对路径);背景图片小于块大小...

  • 背景

    设置背景 背景的偏移和定位 按钮练习 作业

  • 背景

    其实这也是一种利益这段话。他并没有实际上的去使用父母的背景。 而父母却会暗地里使用自己的背景去帮助他。 这样子他记...

  • 背景

    请认真思考一下你的身份: 一个毫无任何背景的普通人。 父母是普通老百姓,上半辈子一直是面朝黄土背朝天,以土为生。下...

  • 背景

    你站在人群里,一言不发 周围的车流和人流不过是一张背景 你是走是停,没有人能够决定 那一句句埋在心里的话 只能说给...

  • 背景

    人类的孤注一掷成功了。在史蒂芬教授和白鹤少校的带领下,仅有四百万余人和凝聚了人类千年智慧结晶的大量机器成功...

网友评论

      本文标题:背景

      本文链接:https://www.haomeiwen.com/subject/cjdfjttx.html