For my project, I need to design a web page with a single image perfectly centered both vertically and horizontally on the screen. Here are the specific requirements:
- The client's screen size is unknown (mobile)
- The image will be user-defined with unknown dimensions
- The image must remain perfectly centered regardless of device or screen orientation changes
- The centering should persist even when the screen rotates (e.g. from portrait to landscape)
As someone new to CSS, I initially used javascript to position the content in this way: http://jsfiddle.net/error454/8YL9a/
I am seeking a CSS-based solution that achieves the same results without relying on complex equations.