What are the pros and cons of using percentages as your dimension standard for HTML pages [closed]
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this questionI've been using pixel defined width and height dimensions for my HTML elements so far. This works out pretty 开发者_如何学Gofine except when you're faced with bigger screens. What are the pros and cons of using percentages as your standard?
P.S.Also how do you handle the size of fonts?
Good article to read on this topic.
Fixed Vs Fluid Vs Elastic layouts
Pros
- It is the easiest way to the same height.
- It avoids using float or position:absolute for purposes for which they were not intended.
- It provides a simple way for beginners to produce side by side layouts in CSS without polluting their HTML with non-semantic tags.
Cons
- It doesn't work in IE7 and earlier and so you either need to define a different layout for those browsers or mess around with floats or position:absolutes to produce CSS for those browsers which works equally well in other browsers anyway.
- To create a colspan or rowspan effect requires nesting one table inside another.
- It encourages people to build grid layouts rather than taking a more flexible approach.
If you've defined maximum and minimum heights, there aren't many disadvantages other than the constant worry that if your new posted content will look good on every resolution. And there is still the problem of percentage rounding and overlapping margins... Stubbornella is known to find solutions to the most of the problems that come with flexible layouts (see the demo page) and also there is this The Perfect 3 Column Liquid Layout by Matthew James Taylor.
精彩评论