Responsive Web

What is Responsive Web Design?

  • Making a website readable by changing the width or layout according to the resolution so that users can use the website comfortably regardless of which device they use to visit

    • Building one website that provides an optimized website for the screen resolution of various devices

the adaption to different devices

1. viewport meta tag

  • viewport refers to the visible area of a web page

    • The viewport varies depending on the device

    • Using the viewport, you can provide an optimized web page to users of various devices by considering the characteristics and screen size of the device

  • meta tag is used to deliver metadata to the browser or search engines for Search Engine Optimization (SEO)

    • The viewport meta tag provides information related to the browser's display settings

      Property
      Description
      Usage

      width

      viewport width (px). Default: 980px

      width=240

      width=device-width

      height

      viewport height (px)

      height=800

      width=device-height

      initial-scale

      viewport initial scale

      initial-scale=1.0

      user-scale

      Zoom in/out availability

      user-scale=no

      maximum-scale

      viewport maximum scale

      maximum-scale=2.0

      minimum-scale

      viewport minimum scale

      minimum-scale=1.0

    • The px unit is used in meta tags, and the unit expression is omitted

    • When using multiple properties, separate them with commas (,)

    ex)

    • The most common viewport setting

    • Setting the horizontal width to match the device width and the initial screen scale to 100%

2. @media

  • Enables specifying different styles for different media types (print, screen, etc.)

  • A core technology used in Responsive Web

  • Specifying styles for each media using @media is called a Media Query.

    • Can distinguish not only the device but also the size and ratio of the device

Example of specifying different styles for normal screen and print devices

Media Query Syntax

Media Query Example

Property
Description

width

viewport width (px)

height

viewport height (px)

device-width

Physical width of the device (px)

device-height

Physical height of the device (px)

orientation

Device orientation (landscape: horizontal, portrait: vertical)

device-aspect-ratio

Physical width/height ratio of the device

color

Maximum color bit depth the device can display

monochrome

Bits per pixel for monochrome devices

resolution

Device resolution

Bootstrap Media Query

Bootstrap - Layout

Grid System

Bootstrap's grid system uses a series of containers, rows, and columns to layout and align content.

It's built with flexboxarrow-up-right and is fully responsive.

  • The Grid System is a method for composing balanced layouts, and in Bootstrap, you can freely compose responsive layouts.

Grid System Breakpoint

  • break point

    • .col, .col-sm, .col-md, .col-lg, .col-xl

  • .container

    • To use Bootstrap's grid system, a .container must always exist as a parent

    • .container

    • .container-fluid

  • .row

    • Composed of 12 columns

    • .col - {breakpoint} - {number}

12 column grid

: Bootstrap uses 12 columns because 12 is a flexible number for division

Mix and match

Don't want your columns to simply stack in some grid tiers? Use a combination of different classes for each tier as needed.

ex)

Gutters

  • Padding values between items

  • Can be removed using .no-gutters!

Offsetting columns

  • Move columns to the right using .offset-md-* classes

  • In addition to column clearing at responsive breakpoints, you may need to reset offsets

    • .offset-md-0

@media

Think of it as a conditional statement!

viewport min width device

Tips

  • Looking at the Bootstrap description

    • It says Build responsive, mobile-first projects on the web with the world's most popular front-end component library

    • Think from small -> large

  • height is affected by the content and child elements!

Last updated