CSS placing one image on top of another

Om3ga

I am working on CSS design template.

I have two images imageOne and imageTwo.

Both are position: relative because if I set one of them position: absolute then it does not stay as responsive anymore and responsiveness is the key here.

What I want is to place imageTwo on top of imageOne.

How can I achieve that while twitterbootstrap's responsive feature still works on these two images?

Below is my code: (jsfiddle available here)

<div class="imageOne image"></div>
<div class="imageTwo image"></div>

CSS

.image {
    position: relative;
    width: 100px;
    height: 100px;
    border: 1px solid red;
}
.imageOne {
    z-index: 0;
}
.imageTwo {
    z-index: 1;
}
Ed T.

I've added a wrapper div for those images, with position relative and changed .image { position: relative to absolute and it worked for me. http://jsfiddle.net/uS7nw/2/

<div class="container">
    <div class="imageOne image"></div>
    <div class="imageTwo image"></div>
</div>

And

.container {
    position: relative;
}

.image {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 1px solid red;
}

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How to fix an image compared with another one in CSS?

분류에서Dev

Issue on Positioning Transparent Image on The Top of another Using CSS rule

분류에서Dev

HTML CSS Hover Image Link with One Image

분류에서Dev

How to encrypt one image inside another?

분류에서Dev

Display image on top of gif

분류에서Dev

CSS3: How do I make a linear gradient on top of an image suitable for cross browser compatibility?

분류에서Dev

Return to top after click on image

분류에서Dev

One frame at top of window, one at bottom

분류에서Dev

CSS - Do Not Make Line on Top

분류에서Dev

On top how to display Another layout in android

분류에서Dev

How to expand a div situated on top of another with javascript?

분류에서Dev

Left top Justify text to floated image

분류에서Dev

Get rgba values of top sliver of image

분류에서Dev

Scaling a geometry in one direction with top as reference in threejs

분류에서Dev

Foundation - Top Bar and Icon Bar in one template

분류에서Dev

Overlay second image on top of image within ImageViewTouch on Android

분류에서Dev

Replace an Image when another Image is uploaded

분류에서Dev

CSS Align image with input

분류에서Dev

Image Masking using css

분류에서Dev

Text over Image CSS

분류에서Dev

resize image using css

분류에서Dev

CSS - Flip image

분류에서Dev

background-image with css

분류에서Dev

CSS Responsive background image

분류에서Dev

Jquery Remove Clear Top CSS attribute

분류에서Dev

Html and css social buttons stuck top of the page

분류에서Dev

HTML/CSS body isnt at the top of the page

분류에서Dev

CSS - Top to Logo = 0px

분류에서Dev

CSS Positioning: Fixed Left or Top when scrolling