Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Fitting content to a non-scrollable page

Hi, I am learning html and css and also trying to get my head around responsiveness.

I have built this page in Wordpress and want all of the content - header, hero image, grid boxes and footer to fill and fit to the screen on all screen sizes until it becomes stacked on a mobile phone and small tablet. I don't want to have to scroll on desktop and large tablets.

https://imgur.com/a/wXqUSCb

Is this even possible with the nature of responsiveness? Or, as you minimise the screen, does the sides and footer get chopped off?

Can anyone point me in the direction of how to build a page like this or what CSS to use?

Thanks!

Julien Rotundo
Julien Rotundo
10,018 Points

The first things I would look into would be the use of viewport height, flexbox, and maybe html/body height at 100%. I don't have a set answer for it without actually trying to build it, but those are key words that should get you going. Hope this comment is helpful. Good luck.

Gari Merrifield
Gari Merrifield
9,598 Points

Continuing on with Julien's suggestions, you may want to look at Grid layout and the fr unit of measurement, there are a number of very nice features in grid, and it lets you place things very nicely. Combining that with media queries, you can change the grid positions of selected objects, based on the screen dimensions, and can probably even force scrolling options on below a certain size and off above that size.

1 Answer

Paul Walker
Paul Walker
28,904 Points

Both the previous suggestion sounds good. Using the Viewport Height property would be the best way to solve the problem. I would use the flexbox because I'm more familiar with how that works compared to the grid system. Just looking at your sample site, Use flexbox for the sidebar and the content with CSS. Good luck Holly.