Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

Responsive web design - how do you know how many pixels

Hi - quick question. For determining breakpoints how do you know how many pixels the screen is at when you are making it narrower and wider? Is this just an estimation or is this information available on the browser window (I am using Chrome). Just curious if there is a better way than trial and error...

3 Answers

James Barnett
James Barnett
39,199 Points

The easiest way to find break points is to use http://responsivepx.com/ You can also use the Window Resizer extension.

When testing your media queries use responsinator.

If you want to measure the size of an element in pixels use the MeasureIt! extension

There's probably a better way of doing this, but if I have to find out the width of the browser, I select a full width element in the html in inspector (the body tage for example). Chrome highlights the element and shows a little yellow tooltip that shows the width and height in pixels. Or select the body tag and check the width on the 'computed styles' in inspector.

If you use Firefox, you can use the Firebug and Web Developer tools. They are more developer-friendly than Chrome's Tools or plugins.

One such option in the Web Developer Add-on by Chris Pederick is the Display Ruler (American Spelling) option. With that, you can get the pixel dimensions of an existing object or highlight a region on the screen to get its offset and dimensions.