Question

While working on my webpage I set a fixed pixel width to my content wrapper (a < div >) and to the elements inside I use relative % values for all css properties (margins, width,padding,..) this way all the webpage content is adjusted by the wrapper pixel width as reference. So the question is: is this a good practice? Using % values for most of my html items? Or should I translate it to pixels (since wrapper width is fixed)?

Was it helpful?

Solution

A problem I can see here is, for example, a title box or header. This is because if the size of the container changes, you may find that it is harder to get the text to scale.

Otherwise, this is probably a good technique to use providing that you don't use much advanced animation or anything, and makes the site suited to all users. However I'd still recommend an alternate site for tablet/mobile users.

Good luck!

OTHER TIPS

Bottom line, if the container will always remain the same width it doesn't really matter, because the % is relative to the container which is always fixed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top