zoukankan      html  css  js  c++  java
  • css background之设置图片为背景技巧

    原文

    Background是什么意思,翻译过来有背景意思。同样在css里面作为css属性一成员同样是有背景意思,并且是设置背景图片、背景颜色、背景图片截取等样式。

    首先先来看看background有那些值(可进入CSS手册background详细了解)

    可以按顺序设置如下属性(可点击进入相应的css手册查看使用):
    background-color 背景颜色
    background-image 背景图片
    background-repeat 背景重复
    background-attachment 背景图片是固定还是滚动
    background-position 背景图片的定位

    接下来我们重点来讲解css background通常的使用方法
    首先我们来看下面一段代码
    background:url(bgimg.gif) no-repeat 5px 5px;
    如下图解释
     

    从图上的CSS background解析图我们可以详细了解到background的css属性使用方法。

    background:url(bgimg.gif) no-repeat 5px 5px;这样的css背景表达可以节约和优化css文件代码。
    学习者可以使用和测试更改background各个属性来了解和掌握关于css background

    如需转载,请注明文章出处和来源网址:http://www.divcss5.com/jiqiao/j80.shtml

  • 相关阅读:
    堆排序回顾
    动画函数封装
    mouseenter 和mouseover的区别
    元素滚动 scroll 系列
    元素可视区 client 系列
    元素偏移量 offset 系列
    JS执行机制
    BOM
    常用键盘事件
    常用鼠标事件
  • 原文地址:https://www.cnblogs.com/xiaoshen666/p/10725370.html
Copyright © 2011-2022 走看看