0

I am trying to build a two column design with an Angular 2 app. I created a plunker to reproduce my problem: https://plnkr.co/3Evxm9?p=info

I want the scrollable area to be the red div (.overflow), not the .page. Without the .page { overflow: auto } the page won't scroll at all, though I would expect .overflow to do so since it has a defined height of 100%. The padding is there to offset from the .top div. I initially though using margin instead, but without the overflow: auto on .page, the margin goes outsides the bounds of .container (which shrinks to fit the height (padding included, margin excluded) of .overflow.

I seem to misunderstand the behaviour of the flexbox.

1 Answer 1

2

I made some adjustment to your css to make the red area scrollable only.

css:

.page {
  width: 100%; height: 100vh;
  background: red;
  flex: 1;
  overflow: hidden;
}

.overflow {
  font-size: 30px;
  padding-top: 64px;
  height: 93vh;
  overflow: scroll;
}

Thanks for providing a plunker. It helped a lot to find a solution for you. Here's the link to the edited plunker.

Hope this helps!

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the reply ! The problem I have with your solution, which indeed works well, is that the scrollbar does not show for the correct area. It should only go up until the bottom of the blue area. I need the red area to fill exactly the remaining space of the screen below the blue area. I only see two approaches so far: (1) margin-top with the height of the blue area, and height of 100%; (2) .page with display:flex, column direction, and .overflow with flex one, but then we need additional nodes inside .overflow to perform the scroll. I'll upvote you :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.