Responsive Web Design with Media

What Is Responsive Web Design?

Responsive web design refers to progressively enhancing a web page for different viewing contexts (including smartphones and tablets) through the use of coding techniques including fluid layouts, flexible images, and media queries.1 This is accomplished with the following techniques:

  1. Flexible Measurements
  2. Flexible Images
  3. Media Queries
  4. Redesign for Screen Sizes
  5. Use of Meta Viewport Tag

Flexible Measurements

Web designers use measurements that adjust to the screen size available such as % for container widths and ems for font sizes or padding rather than a fixed measurement such as a pixel (px). An em is a relative unit of measurement based on the default font size of the web browser. 1em would be the same size as the default size. Decimals such as .5em can be used to declare half the size of the default font.

Flexible Images

Images become flexible when their height and width attributes are removed so that they no longer have fixed size constraints. A max-width of 100% rule is added in CSS which allows the image to flex as the page is scaled smaller.

Media Queries

Media queries set breakpoints for different screen sizes based on typical measurements such as a full screen for monitors, tablet sizes and then mobile size screens. Typical widths used for those breakpoints are at 64em for tablets and 37.5em for smartphones.

Redesign for Screen Sizes

Because the screen real-estate is so dramatically different, a benefit of using media queries is the ability to move content and other elements around to optimize the user experience based on what size viewport they are using. Full size screens tend to have content spread out more horizontally where smaller devices such as smartphones tend to be narrow, so designers will modify the scheme vertically.

Meta Viewport Tag

The meta viewport tag <meta name="viewport" content="width=device-width, initial-scale=1.0"> is placed in the Head section of an HTML file and tells the browser to scale the page to the size of the viewport. This ensures that no matter what size screen is being used, the page will look as it was intended.

Common Media Types

Media are the communication outlets or tools used to store and deliver information or data. 2 The World Wide Web itself is a medium used to share information where files written in hypertext markup language (HTML) can be viewed with a software application called a web browser. In its most basic form, a web page will contain text which may also include links to other web pages. Cascading style sheets (CSS) and JavaScript are two other languages that, combined with HTML, make websites informative, attractive, and interactive.

In addition to basic text, there are many types of media incorporated into web sites in order to enhance the user experience or communicate in a different way. The most common of those we will discuss are:

Flex and Respond

Change the width of your browser to see this image flex and the page content respond fluidly!

Oean Sunset