简体   繁体   中英

CSS Can't move my images

I'm trying to move some images but I can't move them. I moved other images just fine but these ones won't move?

HTML : (it's a little larger with more images but i can't even move one)

<main> 
  <p class="window1"> Window 1 </p>
  <img class="uparrow1" src="images/up.png" alt="Up">
</main>

CSS:

.uparrow1 {
  position: absolute;
  top: 300px;
  left: 100px;
}

It doesn't response at any command.

确保将包含的 div 设置为position: relative ,在本例中为.main

You can't move your child elements positioned in absolute if you don't set your parent element in relative.

Ex.

CSS

.parent{
  position:relative;
}

.child{
  position:absolute;
  left:100px;
}

HTML code

<div class="parent">
  <div class="child">Move me</div>
</div>

Resources for more info: http://www.w3schools.com/css/css_positioning.asp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM