2-7 编程练习作业提交

来源:2-7 编程练习

MiMicccc

2020-09-08 15:40:17

<!DOCTYPE html>
<html>
    <head lang="en">
        <meta charset="UTF-8">
        <title>background-origin</title>
        <style>
            div {
                width: 300px;
                height: 100px;
                padding: 20px;
                border: 10px solid purple;
                background: url('http://climg.mukewang.com/582c342b0001fd6507000210.jpg') no-repeat top left;
                background-origin: border-box;
            }
            div:hover {
                background: url('http://climg.mukewang.com/582c34220001091605000150.jpg') no-repeat 10px 10px;
                background-origin: padding-box;
            }
        </style>
    </head>
    <body>
        <div></div>
    </body>
</html>


写回答

1回答

好帮手慕星星

2020-09-08

同学你好,样式需要调整

1、默认边框应该有透明效果,可以使用rgba()完成,内容从padding部分开始裁剪

2、移入之后背景图片起点从内容区域,裁剪到边框

参考

http://img.mukewang.com/climg/5f576b710906ff0606010389.jpg

自己再测试下,祝学习愉快!

0

0 学习 · 40143 问题

查看课程