treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Nested div question

  • 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

  • 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