Search code examples
htmlcsspositioningabsolutemarquee

Cannot Position Correctly with HTML


Basically I want the image to fall down the screen all the way through the right side of the window and I tried it like this (see snippet below)

#falling2 {
  position: absolute;
  top: 0;
  right: 0;
  z-index: -2;
}
<marquee id="falling2" height="100%" direction=down scrollamount="20">
  <img src="http://via.placeholder.com/50x50">
</marquee>

However, it stays glued to the left side for some reason.

I tried solutions from here on stack overflow but they did not seem to solve my problem.


Solution

  • #falling2 {
        position: absolute;
        left: 0;
        z-index: -2;
        text-align: right;
    }
    <marquee id="falling2" height="100%" direction=down scrollamount="20">
        <img src="http://via.placeholder.com/50x50">
    </marquee>