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

[Solved] Responsive Design - height

  • Sorry if this is a silly question but how do you set height of containers to be flexible and relative to the size of the device used? Do you simply convert pixels to percentages based on the parent container or is there more to it than that? I notice a lot of site don't seem to set a height, apart from the body, at all.
  • Typically, height is defined by what is inside of it. So, without doing anything it's dynamic on it's own.
  • @JoshWhite - so by that do you mean padding and margins at relative values form the shape of the containers?
  • Height in itself, as Josh said, is dynamic,. So if you put a paragraph in it, the element will be has high as the paragraph dictates. If you want to use a 100% height for something, you have to set the html, body, and any other parent to 100% height first.
  • So Overflow: hidden is the way to go.