Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Centering 3 Flexible, Floating Divs Horizontally Inside A Flexible Div Wrapper? Please Help

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #40125
    GAtkins
    Member

    I have done a little bit of looking around, and banging on some code but can’t quite figure it out.

    The Pen is here: http://codepen.io/GAtkins/pen/yCmxH

    How do I center the the divs inside the green container in a flexible layout?

    Any help will be greatly appreciated and thanks in advance.

    Glenn

    #111212
    Paulie_D
    Member

    I’ve played with it a bit and it’s quick and dirty as I didn’t have a lot of time.

    If you want proper calculations you have to NOT mix percentages and px/em etc. Margins (right and left) can be expressed as % of the width and with the proper box model applied see Pen.

    You can just add up the the percentages and make sure they don’t exceed 100%.

    http://codepen.io/Paulie-D/pen/HqutC

    This might help although I didn’t implement it. https://css-tricks.com/dont-overthink-it-grids/

    #111220
    GAtkins
    Member

    Magic! Very nice. Thank you very much Paulie….

    Glenn

    #111225
    Paulie_D
    Member

    I do my best…..:)

    #166538
    clintmannar
    Participant

    CSS code for center Div

    margin: 0 auto;

    Examples… Center Floating Div

    Clint

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.