I recently found a site that used a div with position absolute, and the top, left, right and bottom values all set to 0. This created a 100% high, 100% wide div. I am now using this as well, and was wondering if there is any reason not to?
It works really well, it’s a simple solution, and the other way I was using had a bug I couldn’t fix. The application I’m using this for should only every take up the browser window, and never needs to be bigger.
This technique works fantastically in modern browsers – there is no reason not to use it.
(unless you care about some really old browsers (IE5/6?), which don’t support setting
topandbottomorleftandrighton the same element)Here’s an answer I wrote earlier today which uses a similar technique.