为什么加上在background 后加上 center背景图就不显示啦?

来源:4-3 编程练习

慕莱坞8202083

2019-05-19 23:23:36

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
<title>123</title>
<style type="text/css">
    *{padding:0px;
      margin:0px;   
    }
    .main{
        width:100%; 
        height:2000px;
        background: url(http://climg.mukewang.com/59c9f7ce0001839219034033.png)
        top left no-repeat center  ;
       background-size:%;
</style>
</head>
<body>
<div class="main">
</div>

</body> 
</html>


写回答

1回答

好帮手慕码

2019-05-20

同学你好!
因为在之前已经设置过top,left啦,在写一个center相当于给background-position设置了三个值会冲突

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

它的取值可参考:

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

举个例子。给同一个div连着设置两个颜色也是不生效的。

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

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

祝学习愉快,望采纳~

0

0 学习 · 40143 问题

查看课程