1.CSS3 Introduction
CSS3 is an upgraded version of CSS (cascading style sheet) technology, which was developed in 1999, and was completed on May 23, 2001 by the CSS3, including box models, list modules, hyperlinks, language modules, backgrounds and borders, text effects, multi-column layouts, and other modules.
2.CSS3 Background
<css3> Overview
There are several great background properties that provide more powerful control over the background.
backgroud-size
: Specifies the size of the background image.
background-orgin
: Specifies the area where the background image is located.
backgroud-clip
: The drawing area that specifies the background.
< browser support >
Internet Explorer + +, Firefox, Chrome, Safari, and Opera (these browsers support CSS3 background properties)
(1)
baground-size
(Specify the size of the background image)
body{
background: url(给你的背景插入一张图片)background-size(规定你背景图的大小)background-repeat(使你的背景图向下延伸)padding-top(你的背景距离顶部的距离)
}
There are four ways to set the background size.
<* Value definition >
Sets the height and width of the background image.
The first value sets the width, and the second value sets the height.
If you set only one value, the second value is set to Auto.
<* percent > (slightly)
(2)
background-orgin
(Specify the location area of the background image)
body{
background-origin:content-box;(背景图像填充框的相对位置)background-origin:border-box;(背景图像边界框的相对位置)background-origin:padding-box;(背景图像的相对位置的内容框)
}
Location of the background map
(3)
backgroud-clip
(drawing area with specified background)
body{
background-clip:content-box;背景绘制在内容方框内(剪切成内容方框)background-clip:padding-box; 背景绘制在衬距方框内(剪切成衬距方框)background-clip:border-box;默认值。背景绘制在边框方框内(剪切成边框方框)}
Attached: # # #背景-Shorthand Property # # #
In the above example we can see the background color of the page through a lot of properties to control.
To simplify the code for these properties, we can combine these properties in the same property.
The shorthand property for the background color is "background":
body {background:#ffffff url(‘img_tree.png‘) no-repeat right top;}
Note: Please let me know if there is any mistake above.
css< background >