Created
September 8, 2011 08:21
-
-
Save tango238/1202917 to your computer and use it in GitHub Desktop.
[CSS3] Media Query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Media Query</title> | |
<style> | |
@media screen and (max-width: 450px) { | |
.scr480 { | |
background: #ff99cc; | |
} | |
} | |
@media screen and (min-width: 480px) and (max-width: 768px) { | |
.scr480-768 { | |
background: #99ccff; | |
} | |
} | |
@media screen and (min-width: 768px) and (max-width: 900px) { | |
.scr768-900 { | |
background: #00ff99; | |
} | |
} | |
@media screen and (min-width: 900px) { | |
.scr900 { | |
background: #ff9900; | |
} | |
} | |
</style> | |
</head> | |
<body> | |
<section id="wrapper"> | |
<header> | |
<h1>Media Query</h1> | |
</header> | |
<article> | |
<div class="scr480"> | |
<span>The view area is less than 480px.</span> | |
</div> | |
<div class="scr480-768"> | |
<span>The view area is between 480px and 768px.</span> | |
</div> | |
<div class="scr768-900"> | |
<span>The view area is between 768px and 900px.</span> | |
</div> | |
<div class="scr900"> | |
<span>The view area is greater than 900px.</span> | |
</div> | |
</article> | |
</section> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment