zoukankan      html  css  js  c++  java
  • 图解 CSS (4): background 背景

    background
    background-color
    background-attachment
    background-image
    background-position
    background-position-x
    background-position-y
    background-repeat
    

    设置背景色(譬如红色): background-color: red; 或者 background: red;



    背景图片: background-image: url(路径); 或者 background: url(路径);
    其中的路径可以是相对或绝对路径, 可以带双引号或单引号.



    background-repeat(背景图片反复方式): repeat(默认)、no-repeat、repeat-x、repeat-y.






    background-position(背景图起始位置):
    上中: top 或者 top center
    上左: top left(默认)
    上右: top right
    中心: center 或者 center center
    中左: left 或者 center left
    中右: right 或者center right
    下中: bottom 或者 bottom center
    下左: bottom left
    下右: bottom right
    还可以用百分比或具体的数值描述: x% y% 或 xpos ypos
    













    background-position 本来就是有 x、y 两个值构成的, 也可用
    background-position-x 和 background-position-y 单独设定.

    background-attachment(设置背景是否随滚动条滚动): scroll(默认)、fixed(不滚动).



    用 background 可以同时设置:
    background-color、background-attachment、background-image、background-position、background-repeat
    竟没有顺序的要求, 也可随意省略, 只是 position 用两个值时不要分开即可.



  • 相关阅读:
    HAOI2008题解
    codeforces round375(div.2)题解
    codeforces round373(div.2) 题解
    TJOI2015题解
    CF976D. Degree Set
    dtoj#4243. 熊猫(i)
    dtoj#4242. 大爷(w)&&CF1061E
    CF786C Till I Collapse
    dtoj#4239. 删边(cip)
    dtoj#2504. ZCC loves cube(cube)
  • 原文地址:https://www.cnblogs.com/del/p/1381229.html
Copyright © 2011-2022 走看看