Treehouse: Grow your CSS skills. Land your dream job.

Center one element between two floating elements

  • # August 2, 2012 at 1:50 am

    Or don’t float them… I don’t know…

    This is specifically what I’m trying work with. I want all three on one line. Twitter left, FB right.

    Please and THANKS!

    # August 2, 2012 at 6:59 am

    Basically the important part is that the centred div come after the left and right divs in the markup. Check out this example, it uses margin-left: auto and margin-right: auto on the centered div, which causes it to be centred.


    # August 2, 2012 at 7:30 am

    I think its good to learn new things from here.

    # August 3, 2012 at 9:40 am

    Perfect! Come to think of it, I think I had noticed that while scouring Google for a few examples, but it’s importance was never pointed out so I guess I never tried it.

    Thanks for the help!

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

You must be logged in to reply to this topic.