当前位置: 首页 > 网络学院 > 网页制作基础教程 > CSS > CSS 背景

CSS
CSS 介绍
CSS 语法
使用 CSS
CSS 背景
CSS 文字
CSS 字体
CSS 边框
CSS 边距
CSS 填充
CSS 列表
CSS 尺寸
CSS 类别
CSS 定位
CSS 伪类
CSS 伪元素
CSS2 Media类型
CSS 摘要
CSS 实例
CSS2 参考资料
CSS2 打印

CSS 背景


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 1039 ::
收藏到网摘: n/a

The CSS background properties define the background effects of an element.
CSS的background属性可为元素定义背景效果。


实例

Set the background color
This example demonstrates how to set the background color for an element.
怎样为元素设置背景颜色

Set an image as the background
This example demonstrates how to set an image as the background
将图片设置为背景

How to repeat a background image
This example demonstrates how to repeat a background image.
如何重复背景图片

How to repeat a background image only vertically
This example demonstrates how to repeat a background image only vertically.
如何让背景图片垂直重复

How to repeat a background image only horizontally
This example demonstrates how to repeat a background image only horizontally.
如何让背景图片水平重复

How to place the background image
This example demonstrates how to place the image on the page.
如何将图片放在页面上

How to set a fixed background image
This example demonstrates how to set a fixed background image. The image will not scroll with the rest of the page.
怎样让背景图片固定在背景上,不跟随页面一起移动

All the background properties in one declaration
This example demonstrates how to use the shorthand property for setting all of the background properties in one declaration.
怎样使用一句声明就能设置所有与background属性有关的值


CSS Background Properties
CSS 背景属性

The CSS background properties allow you to control the background color of an element, set an image as the background, repeat a background image vertically or horizontally, and position an image on a page.
CSS背景属性允许你控制元素的背景颜色,设置一图片做为背景,垂直或水平的重复背景图片,和图片在页面上的位置。

Browser support: IE: Internet Explorer, F: Firefox, N: Netscape.
浏览器支持: IE: Internet Explorer, F: Firefox, N: Netscape.

W3C: The number in the "W3C" column indicates in which CSS recommendation the property is defined (CSS1 or CSS2).
在W3C中的数字代表CSS的版本(CSS1或CSS2)

Property属性 Description描述 Values值 IE F N W3C
background A shorthand property for setting all background properties in one declaration
一个速记属性来用一个声明设置所有背景属性
background-color
background-image
background-repeat background-attachment background-position
4 1 6 1
background-attachment Sets whether a background image is fixed or scrolls with the rest of the page
设置背景图片为固定还是滚屏的
scroll
fixed
4 1 6 1
background-color Sets the background color of an element
为一元素设置背景颜色
color-rgb
color-hex
color-name
transparent
4 1 4 1
background-image Sets an image as the background
设置一图片做为背景
url
none
4 1 4 1
background-position Sets the starting position of a background image
设置背景图片的起始位置
top left
top center
top right
center left
center center
center right
bottom left
bottom center
bottom right
x-% y-%
x-pos y-pos
4 1 6 1
background-repeat Sets if/how a background image will be repeated
如果背景有重复图片的话就用这个设置
repeat
repeat-x
repeat-y
no-repeat
4 1 4 1

评论 (0) All

登陆 | 还没注册?