1

I currently have a screen layout like this

enter image description here

I have to render componene 2 inside component 3 in below way

enter image description here

Due to certain restrictions i cannot put angular component 3 inside angular component 2

so what i have done is to use css to achieve the desired effect

.component3 {
    position: relative;
 z-index: 1
}

.component2 {
   position: absolute;
  margin-left: calc(100% - 169px);
  margin-top: 13px;
  z-index: 2;
}

I have achieved the desired output however once user scrolls page the component 2 keeps showing on page. It is not supposed to scroll

what can i do for it ?

5
  • You can try position: sticky. css-tricks.com/position-sticky-2 Commented Sep 26, 2019 at 6:53
  • Can you put component 3 inside component 2? Commented Sep 26, 2019 at 7:03
  • @JensAlenius No .. thats the restriction Commented Sep 26, 2019 at 7:07
  • Then please update you question. You wrote: Due to certain restrictions i cannot put angular component 2 inside angular component 3. Then it should be the other way around? Commented Sep 26, 2019 at 7:13
  • @HarunYilmaz when i put postion: sticky and bottom: 0 it does stick.. but requirment is not met.. the comp2 is not getting overlapped on comp 3 Commented Sep 26, 2019 at 7:20

1 Answer 1

3

You need to position component 2 absolutely wrt component 1 and transform the origin to make it stick to the bottom edge as

position: absolute;
bottom: 0;
transform: translate(0, 100%);
right: 0;

Fiddle at https://jsfiddle.net/saksham_malhotra/xkmqy8Lh/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.