Forums

Give help. Get help.

  • # September 8, 2017 at 4:33 am

    Hi,

    I want to take the yellow div in center vertically and horizontally as well, related to the container.

    The 50vh height is important for the container.

    (The floated element should stay where it is.)

    Could you help me?

    # September 8, 2017 at 6:17 am

    There is only one way that I know off (excluding JS) which is to absolutely position the item to be centered.

    Otherwise, the floated element will be taken into account when laying out the elements and affect the centering methods that might otherwise be used.

    # September 8, 2017 at 6:24 am

    You can sort of fake it with Flexbox if you know the size of the floated item by adding a pseudo-element but I wouldn’t recommend this:

    https://codepen.io/Paulie-D/pen/zdVyBW

    # September 8, 2017 at 7:20 am

    Thank you!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag