2014-06-14 62 views
1

我在使用I-Phone顯示固定標頭時遇到了一些問題。標題必須放在中間(如現在)。問題是,我無法用I-Phone放大。智能手機的CSS固定標頭

#header{ 
    position:fixed; 
    z-index: 1; 
    width: 100%; 
    top:0; 
    width:100%; 
    height:100px; 
    padding-top:20px; 
    background:#fff; 

} 
#inheader{ 
    width:825px; 
    margin:auto; 
} 
#headerlogo{ 
    float:left; 
} 
#navmenu{ 
    float:right; 
} 

下面是HTML:

<div id="header"> 
      <div id="inheader"> 
      <div id="headerlogo"> 
       <a href="/home.php" title="home" rel="home"><img src="/images/logo.png" alt="Logo" width="295px"></a> 
      </div> 
     <div id="navmenu"> 
      <!-- horizontal nav-menu--> 
      </div> 
     </div> 

假如任何人同樣的問題嗎?任何幫助?

映入眼簾,yab86

回答

1

你需要讓你的網站了解到的設備和瀏覽器視功能:嘗試:

<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">

在你的HTML頭

+0

謝謝大克里斯。現在的問題是,整個網站非常大,在I-Phone上它不顯示一個屏幕上的頁面。我必須滾動horicontal相當多 – yab86

+0

玩您的網站的視口設置。嘗試:http://stackoverflow.com/questions/1230019/how-to-set-viewport-meta-for-iphone-that-handles-rotation-procellly – Kinnectus

+0

感謝您的鏈接。但是,沒有任何事情發生。我現在做了一個解決方法,只有@media屏幕和...「,並將位置設置爲絕對。這不是我想要的,但我沒有更好的解決方案。看起來,這個位置:固定元素和智能手機並不是最好的朋友。 – yab86