向左浮动会在右侧产生不必要的填充

时间:2012-12-17 14:31:45

标签: html css

你好,每当我在那个页面的某个地方使用一个浮点数时,我会在右边看到一个奇怪的填充。用普通的浏览器可以,但在iPad上查看它有点难看,因为我在右边有一个1厘米的填充物。有谁知道如何解决这个问题?

1 个答案:

答案 0 :(得分:2)

用于ipad特定的CSS

    @media only screen and (device-width: 768px) {
         /* For general iPad layouts */
                }

    @media only screen and (min-device-width: 481px) and (max-device-width: 1024px)   and (orientation:portrait) {
         /* For portrait layouts only */
          }

       @media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape) {
       /* For landscape layouts only */
          }

编辑:

    <!--Target iPad-->
     <link href="ipad.css" rel="stylesheet" media="only screen and (min-device-width: 768px) and (max-device-width: 1024px)" type="text/css" />
    <!--Target iPhone 3GS> -->
    <link href="iphone.css" rel="stylesheet" media="only screen and  (max-device-width: 480px)" type="text/css" />
     <!--Target iPhone 4-->
     <link href="retnia.css" rel="stylesheet" media="only screen and (-webkit-min-device-pixel-ratio: 2) and (max-device-width: 480px)" type="text/css" />

jquery

    if(navigator.platform == 'iPad' || navigator.platform == 'iPhone' || navigator.platform == 'iPod')
   {
    $(window).scroll(function() {
    $('header').css('top', $(this).scrollTop());
    });

   };

并在为IPAD定位时为你的ipad使用特殊的css文件,在你的文件上面的代码将是'ipad.css'