Last active
September 29, 2021 08:34
-
-
Save webketje/fe46d80d1c3f8168e8387988ddb25f5e to your computer and use it in GitHub Desktop.
How <meta name="viewport"> matters
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> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width,initial-scale=1.0"> | |
<style> | |
* { box-sizing: border-box; } | |
html, body { background: #ccc; padding: 0; margin: 0; position: relative; } | |
#container { width: 960px; max-width: 100%; padding: 32px; margin: 32px auto; } | |
#contents { width: 600px; max-width: 100%; padding: 32px; margin: 0px auto; background: white; } | |
img { max-width: 100%; } | |
</style> | |
</head> | |
<body> | |
<div id="container"> | |
<div id="contents"> | |
<h1>Title</h1> | |
<img src="https://via.placeholder.com/600x150/111111" width="600" height="150"> | |
Lorem Ipsum | |
</div> | |
</div> | |
</body> | |
</html> |
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> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<style> | |
* { box-sizing: border-box; } | |
html, body { background: #ccc; padding: 0; margin: 0; position: relative; } | |
#container { width: 960px; max-width: 100%; padding: 32px; margin: 32px auto; } | |
#contents { width: 600px; max-width: 100%; padding: 32px; margin: 0px auto; background: white; } | |
img { max-width: 100%; } | |
</style> | |
</head> | |
<body> | |
<div id="container"> | |
<div id="contents"> | |
<h1>Title</h1> | |
<img src="https://via.placeholder.com/600x150/111111" width="600" height="150"> | |
Lorem Ipsum | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment