2-7这样写可以吗

来源:2-7 编程练习

weixin_慕田峪7033080

2020-05-20 14:03:27

<!DOCTYPE html>

<html>

    <head>

        <meta charset="UTF-8">

        <title>background-origin</title>

        <style type="text/css">

             div{border:6px purple solid;


            width:300px;


            height:140px;


            background:url(http://climg.mukewang.com/582c342b0001fd6507000210.jpg) no-repeat;


            background-clip:content-box;


        }

           div:hover{


            background:url(http://climg.mukewang.com/582c34220001091605000150.jpg) no-repeat 10px 10px;

        </style>

    </head>

    <body>

        <div></div>

    </body>

</html>


写回答

1回答

好帮手慕糖

2020-05-20

同学你好,代码中的问题回答如下:

1、如下:缺少结束的“}”,建议:补充下。

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

2、边框颜色需要设置透明度;建议:可以使用rgba。例:

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

3、开始的时候背景图片显示范围从内边距框开始,建议:设置属性值为padding-box;且可以设置下内边距,例:

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

4、并且背景图片的起点从内容区域的左上角开始向左、向下偏移10个像素,并且背景图片显示范围从边框开始,建议:可设置下background-origin与background-clip属性,例:

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

如果我的回答帮助了你,欢迎采纳,祝学习愉快~

0

0 学习 · 40143 问题

查看课程