css background-image属性为元素设置背景图像,语法为:background-image:url(图片路径)。设置的背景图像会占据元素的全部尺寸,包括内边距和边框,但不包括外边距。

css background-image属性怎么用-LMLPHP

css background-image属性怎么用?

作用:为元素设置背景图像。

说明:元素的背景占据了元素的全部尺寸,包括内边距和边框,但不包括外边距。默认地,背景图像位于元素的左上角,并在水平和垂直方向上重复。

注释:任何版本的 Internet Explorer (包括 IE8)都不支持属性值 "inherit"。

css background-image属性使用示例

<html>
<head>
<style type="text/css">
body {background-image:url('https://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg');}
</style>
</head>
<body></body>
</html>
登录后复制

效果输出:

css background-image属性怎么用-LMLPHP

以上就是css background-image属性怎么用的详细内容,更多请关注Work网其它相关文章!

09-16 22:50