Responsive web design: overflow image with vertical centering

The initiation of the concept of Responsive Web Designing has been a rather new concept emerging steadily in the recent present. It is an innovative approach for web designing in which a site is designed in order to provide an optimal viewing experience. This includes a concept of easy reading, hassle free navigation fused with the need for resizing, panelling and scrolling. The concept can be applied and used in various devices from desktop computers to mobile phones.

The increasing demand for responsive web design

It is important to have a website that is synchronised with the smaller smartphone screens. As companies like Apple and Samsung introduce new and innovative smartphones, there is an ever rising need for extensive technology which can enable websites to adjust with the ever changing screen size. Usually, the visibility of images and other company information in a website differs when it comes to a desktop and ä smartphone. In most cases a website designed for the desktop gets deformed when viewed on the rather smaller screen of your smartphone. Responsive web design promises to address this problem in a cost b effective way.

How responsive web designing helps ?

The Flexible design technology is one such technology that can help. No design, whether fixed or fluid, will be able to scale beyond the context for which it was initially created. Even though the website scales pretty well once the browser window is resized, the stress points quickly start appearing as you shift to lower resolutions. While being viewed from a smartphone with a viewport that is smaller than the usual 800×600, the illustration behind the logo tends to become cropped.  The navigation text wraps in an unseemly manner, making the images along the bottom appear almost illegible.

Virtual centering

In order to solve this problem, you can overflow the image with virtual centering. In this process all you have to do is put the image in a container and set the width of the image to 100%. The maximum height of the container should be increased to 450 px afterwards. The overlap should be hidden by setting the overflow option to–Hidden.

If the width of the container is changed or even resized, it will be seen that the image has adapted to the width of the container without exceeding the maximum height.

However the job is not complete yet. The image has only been cropped partially and it has only been done from the bottom and not from the top. In order to do that, the web designer needs to crop the image from both the ends. This can be done with the help of JavaScript (jQuery). In this process you need to calculate the portion that is to be overlapped, divide it by two and set the margin-top of the image to that particular value.

The JavaScript functions have to be used next for loading, resizing and transitioning the image. The Cascading Style Sheet transition button can be used to change the max-width if needed. The CSS transition option can also be used to make the margin-top of the image smoother.

If your company is looking to target the expanding smartphone market this can well be an ideal option. Moreover, it can also be applicable for android phones too.

This post is written by James Franklin. He helps provide web design tips and tricks through his posts simultaneously working for a company specialized in providing Web Design in Sussex.