Is there a way that you can use PHP to automatically fit a web page into the size of the browsers window?
views:
62answers:
3Not with PHP, but with Javascript or CSS you can.
PHP is server-side technology.
JavaScript and CSS are client-side technologies.
Using PHP or server-code more or less to change HTML/CSS elements wouldn't be optimal. You would want to use HTML and CSS directly. If that doesn't work, your absolute last option might be JavaScript but that's not best practice.
Even with javascript it's often buggy. It's very difficult to take thinks like horizontal taskbars into account. Javascript may find the window to be 500px in height and with the stuff that the user is running it's only 300 or so. Additionally, if someone has Javascript or css turned off, it ruins everything. Best bet is to design in a way that all browsers can deal with it. Make clean compliant designs and let users mess with it if they want to.