时间:2021-07-01 10:21:17 帮助过:6549人阅读
一、html背景图横向平铺代码示例:
- <style type="text/css">
- body{
- font-size:12px;
- font-family:"宋体";
- background-image:url(2.png);
- background-repeat:repeat-x;
- COLOR: #0C2B30;
- }
- </style>
效果如下图:
二、html背景图纵向平铺代码示例:
- body{
- font-size:12px;
- font-family:"宋体";
- background-image:url(2.png);
- background-repeat:repeat-x;
- COLOR: #0C2B30;
- }
效果如下图:
三、html图片全屏代码示例:
- html,body{
- width: 100%;
- height: 100%;
- }
- .mui-content{
- background: url(2.png) bottom center no-repeat #efeff4 ;
- background-size: 100% 100%;
- width: 100%;
- height: 100%;
- }
效果如下图:
那么以上给大家总结了关于怎么让html设置背景图片、html背景平铺等相关知识。希望对有需要的朋友有所帮助。
注:
background 简写属性在一个声明中设置所有的背景属性。
background-size 属性规定背景图像的尺寸。
background-repeat 属性设置是否及如何重复背景图像。默认的背景图像在水平和垂直方向上重复。
background-image 属性为元素设置背景图像。
元素的背景占据了元素的全部尺寸,包括内边距和边框,但不包括外边距。默认地,背景图像位于元素的左上角,并在水平和垂直方向上重复。
以上就是html怎么添加背景图片且让图片平铺整个页面?(代码示例)的详细内容,更多请关注Gxl网其它相关文章!