2014-10-30 53 views
0

我創建使用HTML和CSS簡單的主頁。IE不正確讀取我的CSS - 不能中心內容,也沒有把我的頁腳

對於我中間的內容,我用一個MainWrapper類1000像素寬的,所以一切是中心,但它似乎IE不正確讀取它。我一直在檢查我的代碼,並且一切都很順利。

而且,我試圖底部修復我的頁腳(絕對位置),並且IE瀏覽器也不表現出來。但它顯示了我的標題也是按絕對位置確定的。

+0

是否使用的是IE瀏覽器的版本?並請張貼一些示例代碼太多,所以我們可以弄清楚什麼是錯=) – mikelt21 2014-10-30 20:29:59

+0

示例代碼,請...人們傾向於跳過不包括在假設的努力,該OP沒有付出努力,試圖解決問題問題發佈之前在這裏。 – JRulle 2014-10-30 20:31:12

+1

儘管IE當然有它的兼容性問題,但一個簡單的居中div並不是其中的一個。它告訴我你正在做的事情非常錯誤。後的一些代碼,優選使用的jsfiddle – 2014-10-30 20:33:25

回答

1

這是因爲這很容易:

.mainWrapper { 
    width: 1000px; 
    margin: 0 auto; //Center the div 
} 

如果這不是你想要的,請說明您的問題,並張貼的你已經有一些代碼。

併爲您的頁腳困境:

#footer { 
    width: 100%; 
    height: 50px; 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    background: #000; 
} 
0

這裏是起點爲您介紹的頁面一個最基本的:DEMO

使用margin: 0 auto;中心內容容器很好

<div class="header"></div> 
<div class="main"></div> 
<div class="footer"></div> 

.header, .footer { 
    width: 1000px; 
    margin: 0 auto; 
} 
.main { 
    width: 100px; 
    min-height: 200px; 
    margin: 0 auto; 
} 
-1
Here is the html (CSS lower) 

<body> 
    <header> 
     <nav class="top_bottom"> 
      <!--MENU<ul> 
       <li></li> 
       <li></li> 
       <li></li> 
       <li></li> 
       </ul>--> 
     </nav> 
    </header> 
    <div class="MainWrapper"> 
     <img class="main_logo" src="images/logo_1000x400.jpg" title="Logo Mangeons Maison" alt="Logo Mangeons Maison"/> 
     <div class="top_box"> 
     <p class="msg_const">Notre site Web est présentement en construction pour mieux répondre à vos attentes. Un menu détaillé ainsi qu’un bon de commande seront bientôt disponibles. Pour le moment, vous pouvez nous faire parvenir votre courriel pour recevoir notre menu hebdomadaire et par la suite vous pourrez commander via courriel. Écrivez-nous ou téléphonez-nous et il nous fera plaisir de vous répondre dans les plus brefs délais. </p> 
     <a class="email" href="mailto:#">#</a> 
     <p class="msg_const2">514-555-5555</p> 
     <p class="msg_const1">Merci!</p> 
    </div> 
    </div> 
    <footer class="footer"> 
    <div> 
     <p></p> 
    </div> 
    </footer> 
</body> 

    CSS: 
    .MainWrapper{ 
     width:1000px !important; 
     margin:0 auto !important; 
    } 

    footer{ 
     bottom:0; 
     position:absolute; 
     width:100%; 
     height:40px; 
     background:#E73E29; 
    } 
+0

編輯您的答案以包含其他信息,請勿將其添加爲答案。答案只適用於回答問題的答案。顯然,版主也是{redacted}注意到這一點,因爲我標記這不是一個答案,他們有爭議... ... – 2014-10-31 20:58:45

相關問題