Possible to position something like this?

I am absolute positioning something inside a fluid height element.

    div{
    position: absolute;
    top: 20%;
    left: 0;
    width: 100%;
    }

is it possbile to have it like this but force the element to be at least 260px from the bottom if the height of the parents gets to narrow?

Hi,

You can set bottom:260px which will start the element 260px from the bottom to start with but obviously if the parents height is less than 260px then the bottom will overlap the 20% top and not make much sense (an absolute element’s height can be defined via top and bottom without using an explicit height but of course needs to make sense and not be overstated.).

It sounds like you should be putting a min-height on the parent to stop this eventuality happening in the first place.

You will have to set up a mini-example as there are so many variables to take care of here.

There is also the chance that you could use media queries based on the viewport height to change the dimensions and location of the absolute element also but does depend on how this is set up.

1 Like

Yeah you are right, setting a min-height is probs the best way in my particular scenario.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.