Welcome to the Treehouse Community
Looking to learn something new?
Alex Hird2,767 Points
Difference between setting %'s and px for margins, width's and height.
Just wondering, what's the main difference with setting %'s or px for height, width, margins etc. Just getting into CSS and presenting the HTML structure and just trying to figure it out.
Steven Parker216,135 Points
Pixel dimensions are rigid. Anything sized with them will be the same size on any window or screen.
Percentage dimensions will expand and contract with the size of their container, typically a result of different screen sizes.
So one common use for the difference is whether you want the element you are styling to dynamically adjust to screen sizes, or always be the same on every screen. There are several courses here that explore practical applications for both types for dimensions.