How do I position one image on top of another in HTML?

前端 未结 10 1473
难免孤独
难免孤独 2020-11-22 17:15

I\'m a beginner at rails programming, attempting to show many images on a page. Some images are to lay on top of others. To make it simple, say I want a blue square, with

10条回答
  •  萌比男神i
    2020-11-22 17:46

    This is a barebones look at what I've done to float one image over another.

    img {
      position: absolute;
      top: 25px;
      left: 25px;
    }
    .imgA1 {
      z-index: 1;
    }
    .imgB1 {
      z-index: 3;
    }
    
    

    Source

提交回复
热议问题