Search code examples
cssscreen-resolutionunits-of-measurement

CSS percentage widths and heights and resolution problems


I need my application run in multiple screen resolutions. Currently I have specified all the dimensions in percentage (%) instead of pixels (px) so that it will automatically re-size with the screen.

Which would be the more reliable unit of measurement for specifying dimensions on my webpage: Pixels (or EM) or Percentage


Solution

  • For Responsive Webdesign you really should be leveraging media queries

    Personally I prefer pixels because they give me more control, and I can reliably know the exact dimensions of each element. With media queries you can also set new styles based on the screen resolution.

    Percentages give you a nice responsive feel, but can be much more difficult to ensure you're layout is not junked by each level of resolution.