老师 麻烦看下
来源:2-7 编程练习
xchengguang
2019-09-10 10:59:59
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>background-origin</title> <style> div{ width:500px; height:300px; padding: 30px; border: 20px solid rgba(255,0,0,0.5); background: url("http://climg.mukewang.com/582c342b0001fd6507000210.jpg") no-repeat; background-origin: padding-box; } div:hover{ background: url("http://climg.mukewang.com/582c34220001091605000150.jpg ") no-repeat 10px 10px; } </style> </head> <body> <div></div> </body> </html>
1回答
好帮手慕言
2019-09-10
同学你好,图片没有铺满盒子显示哦。
建议:设置background-size属性
2、当鼠标悬停在元素上时,背景图片的起点从内容区域的左上角开始向左、向下偏移10个像素,并且背景图片显示范围从边框开始,同学没有实现哦
代码参考:
祝学习愉快~