本文摘自PHP中文网,作者青灯夜游,侵删。
在html中,可利用background-repeat属性来设置背景图片的平铺方式;当属性值设置为“repeat”时可向垂直和水平方向平铺,“repeat-x”时可水平平铺,“repeat-y”时可垂直平铺,“no-repeat”时不平铺。

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。
html背景图片设置平铺方式
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | <!DOCTYPE html>
< html >
< head >
< style type = "text/css" >
div{
border: 1px solid #000fff;
height: 200px;
background-image: url(img/1.jpg);
margin-bottom:10px ;
}
#content1 {
background-repeat: repeat;
}
#content2 {
background-repeat: repeat-x;
}
#content3 {
background-repeat: repeat-y;
}
#content4 {
background-repeat: no-repeat;
}
</ style >
</ head >
< body >
< div id = "content1" ></ div >
< div id = "content2" ></ div >
< div id = "content3" ></ div >
< div id = "content4" ></ div >
</ body >
</ html >
|
效果图:
阅读剩余部分
相关阅读 >>
Html怎么让元素隐藏
Html行内元素有哪些
Html form标签怎么用
Html中的标签是什么
Html的this用法是什么
Html关于结构语义化的问题
Html怎么隐藏文本框
Html文档中怎么把图片作为背景?
Html是什么文件
Html的注释是什么
更多相关阅读请进入《Html》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » html背景图片怎么设置平铺方式