i'm trying to convert an old webpage to responsive webdesign.
Minimum width is 480 pixels, a desktop version will be added later with breakpoints.
The code so far:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body{width:480px;margin:auto}
#wrapper{width:480px}
#header{width:480px;height:100px;text-align:center;background:black;color:white}
#content{width:480px;background:#cfcfcf;height:1000px}
</style>
</head>
<body>
<div id="wrapper">
<div id="header">HEADER</div>
<div id="content">CONTENT</div>
</div>
</body></html>
I expected that the webpage will scale down to my mobile device width (320 pixel) but instead it "overflows" (see screenshot, "HEADER" should be centered):
I thought setting the viewport-meta would fix such problems?!
Of course i could tap on the screen to scale/fit to the webpage really to my device width but it should do this by default.
What did i wrong?
Thanks!
@media
? See this link for more. – Esdras Xavierwidth: 100%; max-width: 480px;
instead ofwidth: 480px;
. – arieljuod