Grow your CSS skills. Land your dream job.

Nested div question

  • # December 20, 2012 at 6:31 am

    I’ve been racking my brain about this one, but I cannot seem to figure it out.

    Lets say I have a parent div with dimensions 300w x 200h. This parent div has two children with the same dimensions. I wish to have the two children divs next to each other with overflow-y of the parent set to scroll. I have tried floats and inline-block.

    I can achieve it using absolute positioning. If this is the only way possible, I will bite the bullet and do it this way.
    [Link to Dr. Let](http://codepen.io/alexmccabe/pen/DrLet “”)

    # December 20, 2012 at 6:50 am

    The only way I have ever known how to do it (_mainly because I don’t like horizontal content that scrolls_) is by have the parent container use a set width with an inner container that is the width of the elements within it in which case is `600px` in your example.

    See the following pen for an example: http://codepen.io/ChrisUpjohn/pen/qGAri

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

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".