Skip to content

Instantly share code, notes, and snippets.

@mdang
Last active August 29, 2015 14:21
Show Gist options
  • Save mdang/dc7e574cebee104e0ca0 to your computer and use it in GitHub Desktop.
Save mdang/dc7e574cebee104e0ca0 to your computer and use it in GitHub Desktop.
Mobile Friendly

##I'm Mobile Friendly##

20 min

Let's go back to last week's lab that we developed on Friday. Using media queries, make the page more mobile friendly by removing fixed widths, and applying appropriate font styling depending on the viewport size.

Attribute Example
min-width min-width: 640px
max-width max-width: 640px
min-height min-height: 1000px
max-height max-height: 1000px
orientation (orientation: portrait), (orientation: landscape)
<link rel="stylesheet" media="(max-width: 640px)" href="max-640px.css">
<link rel="stylesheet" media="(min-width: 640px)" href="min-640px.css">
<link rel="stylesheet" media="(orientation: portrait)" href="portrait.css">
<link rel="stylesheet" media="(orientation: landscape)" href="landscape.css">
<style>
  @media (min-width: 500px) and (max-width: 600px) {
    h1 {
      color: blue;
    }
  }
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment