排名相对底部和顶部百分比不起作用为什么?

时间:2018-10-18 18:13:17

标签: css

我可以使用百分比左右移动容器,但不能上下移动容器吗?我可以使用px来做到这一点,但我想使用百分比。为什么这仅适用于左右,而不适用于顶部和底部?

<!DOCTYPE html>
<html>
<head>
<title>Menu</title>
<style type="text/css">
    body{
        background-image: url("My Post.jpg");
        background-size: 100% auto;
    }
    .char{
        width:20%;
        height: 20%;
        background-image: url(effect.gif);
        position: relative;
        left:40%;
       bottom: 100%;

    }
    #char{
        width: 80%;
        height: 80%;
    }


</style>
</head>
<body>

<div class="char">
<img src="char.gif" id="char">
</div>

</body>
</html>

0 个答案:

没有答案
相关问题