Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browser rendering right margin iPhone/iPad/webkit

I have a html snippet below which renders perfectly in all browsers. However in webkit on an iphone and ipad, when I pinch the page (so that its smaller), I see a black border which is the background color of the body shining through only on the right edge. This only happens when I specifiy the width of the .headerpic div. Since this is the only place in the document I specify the width, I was wondering why it stops short of rendering all the way to the right edge (since this is theoretically the widest part of the document?).

I've attached a photo of what it looks like from my ipad.

<!doctype html>
<html>

   <head>

    <style>
      body {background-color:#000;color:#231f20;margin:0;}
      #wrapper {background-color:#fff;min-height:1000px;}
      #header .headerpic {height:102px;padding-top:80px;margin:0 auto;width:986px;}
      #footer {color:#fff;}
    </style>
  </head>

  <body>

    <div id="wrapper">
      <div id="header">
        <div class="headerpic">
        </div>
      </div>
    </div>

    <div id="footer">
    </div>

  </body>
</html>

Photo Of problem

like image 626
robzolkos Avatar asked Mar 01 '11 13:03

robzolkos


1 Answers

In my case using:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

Instead of:

<meta name="viewport" content="width=device-width">

Did the trick!

like image 193
its_me Avatar answered Sep 21 '22 23:09

its_me