Lifestyle Magazine

Responsive Web Design: How to Make It Happen

By Harshil Barot @Harshil_Barot

In today's reality every website needs to operate well on mobile. The growth dynamic of mobile usage does not hint at any subsides to say the least. As a developer you will have to make sure that iPhone, iPad, Android and other devices run it smoothly.

These devices are dissimilar and over the next half-a-decade there will surely be other entrants into this arms race. More and more are coming. As they do, it gets progressively harder to adapt for each specific set of conditions.

Responsive Website Design: An Ultimate Guide

Responsive Web Design: How to Make It Happen

When the new device comes out, more often than not, it tries to be original in terms of the screen size. These vary between devices. The phones have portrait layout while tablets have the landscape.

You can't go from one to another by flipping it though. This is 100% for granted for your audience, and you need to create adaptations for an entire bag of diverse screen sizes.

But hold on a second before putting these potential new outreach mediums on a shelf. There is an answer and it's Responsive Web Design. In a nutshell this means designing your website to make it an ideal fit for any screen, nimbly changing the aspect ratio no matter what kind of mobile hardware you throw at it.

For this, you must implement flexible grids, layouts plus media files. Thoughtfully using CSS media queries also plays a major part in creative web design. As the person casually hops between their device and PC, your rez should adapt accordingly.

The whole approach takes its roots in a namesake experimental theory of responsive design, however, in real estate architecture instead of coding.

Basically, it conceptualizes the creation of premises that can change as the number of people entering and leaving the room at a given time shifts.

You could say the angle is not really new because partly these tenets have long been used in web development. These are fluid layouts, scripts that automatically change format of mark-up and entire pages.

Responsive Web Design, however, to an entirely new mode of focus. Here we address all about custom web design which adapts to most any device one can throw at it.

1] Fluid Images

Much like creating fluid grids, fluid images are in wide use, but the different ways you can go about it are many.

Contemplating how to design a website that is responsive, one reliable way to heavily alter the footprint of your image is to make it scale. You can do this in connection with text size or the shifting dimension of the parent component with simple CSS rules.

For starters, bind a CSS rule to a percentage value. The percentage width is connected to the width of the parent. Alternatively, the way for you to go about it is using the height instead if it is more important to your proportions.

Just don't use both width and height at the same time. Also, you may make it scale relative to the text size by using em value.

When your browser scales the image, it may create some distortion. Reduce this by using a very large image so that the browser would usually scale it down instead of up. You can also restrain your image from shrinking below a certain size if it becomes illegible.

Another way to work with image scaling is revealing only the portions of images when downsizing the web pages. This is applied both to the foreground and background images albeit a bit differently.

You can crop the background image by putting it into CSS. When doing this you will also disable the background image from being printed.

This means that you will print only the contents of the page, improving the readability. It is also important to specify from which side the image will be cropped so that the most important elements are always in scope.

Foreground image deserves a separate segment because, unlike the background, it is important to the contents of the page. At least usually it is. Whether it is in fact important or not, can be determined by answering the following questions:

  1. Is there any information encapsulated into the image that I will need to add as an alt attribute text?
  2. If I printout the page, will it be incomplete without this image?
  3. Am I linking it or not?

If the answer is "yes" to any of the above, then the picture is a relevant foreground image and must be cropped with this in mind. Foreground images are cropped as an img element in the HTML.

The displayed information may be too important in its entirety to be simply cropped off. As for the scaling, it would mess with your design by changing the vertical space the images use.

The solution is creating what you'd call a composite image. The images within the setup will overlap each other to some extent. So the upper one would need a transparent background.

The extension can be both GIF and PNG but PNG is more preferable because it is displayed without the colored edge when laid on top of something with a different color. PNG can also evenly adjust the levels of transparency.

Once the images are combined, you need to nest the two into one planting them into separate blocks. You must use the existing block elements as much as possible. These can be the existing header and wrapper divs and others.

Afterwards, you have to make rules putting each image as an unrepeatable background into every div.

2] Adjustable Layout Structure

When thinking about how to make web design really work for everything, we might get into changing the entire layout via a separate stylesheet, but better to use a CSS media query.

To these ends it is great to have a unified list of styles where we assign the core building blocks. It will also include typography, backgrounds and pallet with default flexible widths.

If the style sheet misses on any of the size parameters, we could insert a new one made as a child. It would take everything from the default and make the necessary changes.

3] Media Queries

CSS will let you create many style sheets and layout manipulations that will allow us to reach the needed ranges of widths. When trying to come up not only with a creative website design but an efficient one too, the best way: put all media queries into one style sheet.

Here you can apply min-width and max-width. min-width selects minimum width for screen or browser the given sheet will work with. Anything lower than this minimum, and the style will not be put into action and anything more than maximum will simply not work.

As for the screen and browser width, it's highly relevant to our ends because you can target specific devices with odd dimensions without reusing the styles for other screens with browsers that repeat the device sizes.

Sometimes a popular preference, you can link an individual style sheet for specific media queries if efficiency can be partly sacrificed. Good method for devices that have single orientation and browsers that don't change width manually.

For instance, the given setup would apply to iPad very well because it changes between portrait and landscape very quickly. If the two queries to change back and forth were each in an individual style sheet, they would unreasonably slow down this transition. Which is why you're better off with putting a media query for the first and the second orientation into one sheet.

This method would work great with a browser that's resizable. If it can, in fact, be changed by the user, the most viable route is unifying all media queries in a combined sheet of styles.

When dealing with devices that can't use CSS queries, you can also avail of JavaScript. A ready-made JS library that enables CSS queries in older browsers is out there. Just download and you can use your queries.

There are multiple ways you can pair JavaScript with CSS media queries. Not a "magic pill", media queries are super helpful for great website design and strictly CSS works. JS can be used to expand your profile of options.

Responsive Web Design: How to Make It Happen

Resizing and rearranging page contents is a lot but sometimes not so good when speaking about website design. It can actually go against mobile design guidelines that encourage simplified and more focused contents as well as streamlined navigation among other things.

It is about flexibility but also about giving the power of choice to the user in terms of displayed elements. And going back to CSS, we can still make the good website design happen.

There are two options: one is to put display: none for the needed block in the needed sheet or determine the browser size via JS. We are not limited to only hiding the elements on tiny devices.

In larger screens, the content in default style sheets can also be concealed, made available only on small size screens. The purpose for this can be replacing content with nav elements that would lead to it or alter the entire layout.

It is important that we use display: none instead of visibility: hidden. It is also important to emphasize that visibility: hidden would only conceal the content when display really removes it. If we keep the markup on tiny screens it would only temper with optimization even causing bugs in certain instances.

Some other stuff you can do for mobile, is to include a script or different stylesheet to get more white space, or change sources for image nav from default to icons.

5] Touchscreen

Mainly the kingdom of mobile, however, when reflecting on how to create web design one should not be dismissive of touchscreens on laptops. Some can transform into tablets. Today, there are more touchscreens with this capability than there used to be.

How should you act in this situation? The two should be approached differently but adaptation to both is not so difficult. In case with touchscreens you should not try to use CSS hovers to define links. Hovers are N/A, the person touches the screen to press a button.

There are some great web design decisions that without much negative impact, if any at all, on cursor navigation, but prove highly creative and valuable with touchscreen, as mainly people are right-handed and they would use it with comfort.

In this article we've discussed how to achieve Responsive Web Design. The methodology helps you to save tremendous amounts of headache. Also really awesome for your audience, a custom decision makes for increased user value.

Using this web design information, you will effectively reach out to users on both older and newer devices. We hope that some of these patterns on how to do web designing will help you achieve a more sound and organized construct with your next project.

You may like.

Back to Featured Articles on Logo Paperblog