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

General Discussion

Joseph Torres
Joseph Torres
6,282 Points

Max Width and Min Width when creating a responsive website question

I want to build a web page but Im a little confused when creating the website dimensions. Should I make a max-width and min-width and what percentage should it be? I know there are different units of measurement but Im told to use percentage for responsive design. For example: body { min-width: max-width: }

This is where Im lost!

1 Answer

Hi Joseph —

Imagine if a physical book was 2 feet wide. It'd suck to read, right? You'd have to tilt your head back and forth, and you'd be prone to losing your place. The same applies to websites. How wide your blocks of text are, while some have tried to define a rule, is ultimately up to your discretion. I'd suggest that a website need not go much wider than about 1200px.

For example:

body {
  width: 100%;
}
div.container {
  width: 90%;
  max-width: 1200px;
}
<!doctype html>

<html>
<head></head>
<body>
  <div class="container">
     your website goes here
  </div>
</body>
</html>

I don't think you need to worry about minimum widths.