I have been using CSS for many years now, and I have always been a ‘percentage’ kind of guy, as in I always define heights and widths using percentages as opposed to pixels (except, for example, when setting things such as margins, padding, etc, in which case I use pixels).
I would do something like this:
body{
height: 99%;
width: 99%;
margin-top: 10px;
}
but I often see examples such as this:
body{
height: 300px;
width: 250px;
margin-top: 10px;
}
My question is this: are there any benefits to using one over the other overall, and if so, what are they?
Mobile webpages. %’s rock for that. As it will (obviously) adjust to suit.
However when you want a fixed width for say example an article of text that you want displayed in a certain way, px’s is the winner.
Both have many plus’s and minus’s over each other 🙂