CSS background-image属性
作用:background-image属性为元素设置背景图象。
语法:
background-image:url(图片途径)
申明:background-image属性设置的背景图象会占有了元素的悉数尺寸,包含内边距和边框,但不包含外边距。默许地,背景图象位于元素的左上角,并在水温和垂直方向上反复。
提醒:请设置一种可用的背景色彩,如许的话,如果背景图象不可用,能够运用背景色带替代。
CSS background-image属性的运用示例
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> #example1 { background-color:#cccccc; background-image:url("https://img.ki4.cn/upload/article/000/000/024/5c6a290265dba776.gif"),url("https://img.ki4.cn/upload/article/000/000/024/5c6a2793a13ac244.gif"); background-position: right bottom, left top; background-repeat: no-repeat, repeat; padding: 15px; } </style> </head> <body> <div id="example1"> <h1>Hello World!</h1> <p>测试文本!测试文本!测试文本!测试文本!测试文本!测试文本!测试文本!</p> <p>测试文本!测试文本!测试文本!测试文本!测试文本!测试文本!测试文本!测试文本!测试文本!测试文本!</p> </div> </body> </html>
效果图:
以上就是本篇文章的悉数内容,愿望能对人人的进修有所协助。
以上就是background-image属性怎样用的细致内容,更多请关注ki4网别的相干文章!