css3 background-size property


  Translation results:

background

UK[ˈbækgraʊnd] US[ˈbækˌɡraʊnd]

n. (painting, etc.) background; background color; background information; soundtrack

Plural: backgrounds

size

## English[saɪz] 美[saɪz]

n. Scale; size, size; glue, paste Paste; huge, large number

vt. Arrange by size; change the size of; apply glue, sizing; apply paint

adj. Third person singular of a certain size

: sizes Plural: sizes present participle: sizing past tense: sized past participle: sized

css3 background-size propertysyntax

Function: Specifies the size of the background image.

Note: Before CSS3, the size of the background image was determined by the actual size of the image. In CSS3, the size of the background image can be specified, which allows us to reuse the background image in different environments.

In CSS3, you can set the size of the background image through the background-size attribute, set the image size through the length value or percentage, or scale the image through cover and contain

css3 background-size propertyexample

<!DOCTYPE html>
<html>
<head>
<style> 
body
{
background:url(http://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg);
background-size:63px 100px;
-moz-background-size:63px 100px; /* 老版本的 Firefox */
background-repeat:no-repeat;
padding-top:80px;
}
</style>
</head>

<body>
<p>上面是缩小的背景图片。</p>

<p>原始图片:<img src="http://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg" alt="Flowers"></p>

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance

Popular Recommendations

Home

Videos

Q&A