zoukankan      html  css  js  c++  java
  • CSS基础学习(二)

    11.CSS背景

    ①设置背景颜色(颜色值通常可以用十六进制(如#000000)或者颜色名称(如red)来表示)

    属性:background-color 

    例:

    body {

    background-color:#b0c4de;

    }

    ②背景图像

    属性:background-image 

    例:

    body {

    background-image:url('https://static.runoob.com/images/mix/paper.gif');

    }

    ③设置图片平铺

    属性:background-repeat

    例:

    body
    {
    background-image:url('https://static.runoob.com/images/mix/gradient2.png');
    background-repeat:repeat-x;      //只在水平方向平铺
    }

    body
    {
    background-image:url('https://static.runoob.com/images/mix/gradient2.png');
    background-repeat:repeat-y;      //只在垂直方向平铺
    }

    body
    {
    background-image:url('https://static.runoob.com/images/mix/gradient2.png');
    background-repeat:no-repeat;      //防止图片平铺
    }

    ④改变图片在背景中的位置

    属性:background-position

    例:

    body
    {
    background-image:url('1.png');
    background-repeat:no-repeat;
    background-position:right top;
    }

    ⑤背景图像是否固定

           scroll:背景图片随着页面的滚动而滚动(默认)

           fixed:背景图片不会随着页面的滚动而滚动。

           local:背景图片会随着元素内容的滚动而滚动


    例:属性:background-attachment

    body {

    background-image:url('1.gif');

    background-repeat:no-repeat;

    background-attachment:fixed;

    }

  • 相关阅读:
    Permission Denial: opening provider 隐藏的android:exported属性的含义
    GPL & Apache License
    JAVA把毫秒数转换成日期
    Android开发–Intent-filter属性详解
    [转]unix/linux中的dup()系统调用
    【转载】技术的正宗与野路子
    virtualbox -centos ping不通外网
    GNU Make 手册中文版
    Git源码学习
    git-gui
  • 原文地址:https://www.cnblogs.com/zyj3955/p/14698106.html
Copyright © 2011-2022 走看看