左右固定图像位置 css

Right and left fixed image position with css

我想放一张左右固定的图片,不知道为什么右边的没有固定的时候只往右走。这是我的代码:

<img src="img/leftImage.jpg" id="leftImage" />
<img src="img/rightImage.jpg" id="rightImage" />

和我的 css:

#leftImage{
  left: 0;
  width: 150px;
  height: 100%;
  position: fixed;
}

#rightImage{
  right: 0;
  width: 150px;
  height: 100%;
  position: fixed;
}

谁能帮我解决这个问题?谢谢!

编辑

这是我的 index.html:

<body ng-cloak>
    <img src="img/leftImage.jpg" id="leftImage" />
    <div id="homescreen" class="container">
        <div ui-view></div>
    </div>
    <img src="img/rightImage.jpg" id="rightImage" />
    <footer></footer>
</body>

和我拥有的CSS:

body {
  background: url(/img/background.jpg) repeat fixed;
  background-position-y: -50px;
  background-position-x: -50px;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

#homescreen {
  margin-top: 150px;
}

容器是 bootstrap class.

您忘记为 top

添加值

做这样的事情:

#leftImage {
  top: 20px; /* your required value */
  left: 0;
  width: 150px;
  height: 100%;
  position: fixed;
}

#rightImage {
  top: 20px; /* your required value */
  right: 0;
  width: 150px;
  height: 100%;
  position: fixed;
}