CSS3 background design
CSS3 has a further improvement compared to CSS2 in the background design of web page elements. It mainly provides the background-size property that can be used to control the size of the background and the background-origin property that can be used to control the background positioning. Although the syntax of this attribute is a little more complicated (mainly because the parameters are more diversified), it can achieve the background effects of web elements that could not be done in the past. For example, the background-size attribute can be set so that the background image will automatically follow the screen zoom Scaling, in traditional web design technology, must be made with Flash, but now it can be done directly through the background design properties of CSS3, and the effect is not bad. Below we will add these two CSS3 background design functions, It is presented for your reference by way of examples.
CSS3 background design example one, background-size property
#PIC_1{
width:380px;
height:100px;
border:1px #ccc solid;
margin-bottom:15px;
}
#PIC_2{
width:380px;
height:100px;
background-image:url(background picture);
background -repeat:no-repeat;
border:1px #ccc solid;
background-size:380px 100px;
}
</style>
This is the background image used, the size is 300x80<br>
<div id="PIC_1"><img src ="Background image"></div>
This is the modified background image, the size is 360x100<br>
<div id="PIC_2"></div>
In-depth study: CSS3 background-size property
CSS3 background design example two, background-origin property
#TextDiv{
border:6px #ddd solid;
width:330px;
height:100px;
padding:10px;
background-image:url(background image);
background-repeat:no-repeat;
background-origin:padding-box ;
}
</style>
<div id="TextDiv"></div>
In-depth study: CSS3 background-origin property
Post a Comment
0 Comments