css背景属性是什么?css背景属性有哪些?相信有很多刚刚接触css的朋友都会有这样的疑问。本章就给大家介绍css背景属性是什么?多重属性怎么实现。有一定的参考价值,有需要的朋友可以参考一下,希望对你们有所帮助。【推荐阅读:css怎么设置4个圆角?css设置4个圆角方法】
CSS多背景属性用于一次添加一个或多个图像而不使用HTML代码。我们可以根据我们的要求添加图像。多背景图像的示例语法如下:
#multibackground{
background-image:url(/css/images/logo.png),url(/css/images/border.png);
background-position:lefttop,lefttop;
background-repeat:no-repeat,repeat;
padding:75px;}
属性显示如下:
微信图片_20181108152914.png
以下是演示多背景图像的示例:
<html>
<head>
<style>
#multibackground{
background-image:url(/css/images/logo.png),url(/css/images/border.png);
background-position:lefttop,lefttop;
background-repeat:no-repeat,repeat;
padding:75px;
}
</style>
</head>
<body>
<divid="multibackground">
<h1>www.php.cn</h1>
<p>
php中文网提供大量免费、原创、高清的php视频教程,并定期举行公益php培训!可边学习边在线修改示例代码,查看执行效果!php从入门到精通,一站式php自学平台!
</p>
</div>
</body>
</html>
效果如下:
微信截图_20181108150923.png
还可以设置背景的大小:
多背景属性为不同的图像添加不同的大小。示例语法如下所示:
#multibackground{
background:url(/css/imalges/logo.png)lefttopno-repeat,url(/css/images/boarder.png)rightbottomno-repeat,url(/css/images/css.gif)lefttoprepeat;
background-size:50px,130px,auto;}
上面的示例所示,每个图像具有50px,130px和自动尺寸的特定尺寸。


本文转载自中文网


本文转载自中文网
如需转载,请注明文章出处和来源网址:http://www.divcss5.com/css3-style/c55063.shtml