Reputation: 798
I have the below Ionic application example in Stackblitz. You'll see that there are a custom Angular component called <my-video></my-video>
, an ion-list
and a button. What I want is:
ion-list
on top of the video. This way, the ion-list
overlaps the video.This is what I have now, you can see the code in the Stackblitz example (including the CSS code):
I think the problem can be that video-container
hasn't the same height as its children my-video
, but I don't know why.
I tried with different positioning configurations (position relative
, absolute
, static
, etc.) with no effect.What would be the correct way to achieve this?
Upvotes: 1
Views: 1570
Reputation: 480
I believe the problem is that my-video
is absolutely positioned, meaning it is taken out of the natural flow of positioning and positioning the button anywhere based on my-video
very tricky, which is not what we want, so you need to make my-video
's positioning relative, keep the options-list position absolute but also add top: 0 and left: 0, like so
.video-container {
position: relative;
my-video {
position: relative;
width: 100%;
background-color: red;
}
.options-list {
position: absolute;
top: 0;
left: 0;
}
}
.finish-button-container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding-bottom: 32px;
position: relative;
}
now the button can go to the bottom of the screen because my-video
is in the flow of positioning
Upvotes: 2
Reputation: 7799
Updated the stackblitz with the following css for your button :
position: absolute;
top: 40%;
left: 50%;
right: 50%;
You need to use position: absolute
here in order to get your button's position relative to the .video-container
div.
Upvotes: 0