2012-02-22 37 views
0

我遇到了問題,我認爲是我的樣式表。我的網站頁面似乎是樹立優良:CSS導致xml被排除在外

然而,當我在瀏覽器中查看它的中間文件是脫節:

難道還有什麼導致這種情況發生?它讓我想到也許在我的CSS文件中是?但是什麼? :(

我的CSS文件如下:

div.left 
{ 
    float: left; 
    width: 15%; 
    background-color: white; 
} 

div.right 
{ 
    float: right; 
    width: 40%; 
    background-color: white; 
} 

div.center 
{ 
    float: left; 
    width: auto; 
    background-color: white; 
    text-align:center; 
} 

回答

1

這是最有可能是由於你的浮動元素,並自中心DIV不浮動所有,而是由float:left「推」到中間左格

如果您div的在HTML像:

<div class="parent_div"> 
    <div class="left"> left </div> 

    <div class="center"> center</div> 

    <div class="right"> right</div> 
</div> 

嘗試浮動中心DIV向左也和它翔uld竅門

div.center 
{ 
    float: left; 
    width: auto; 
    background-color: white; 
} 
+0

將自動更改爲左側...並且工作正常!非常感謝你!!! – 2012-02-22 14:45:14

+0

不客氣。很高興這是一個簡單的修復:)。如果答案正是您在尋找的內容,請花時間和「接受」答案,以便未來其他人也能更輕鬆地解決類似問題。 – Kypros 2012-02-22 14:48:52

+0

只需要等5分鐘才能將其設置爲答案;) – 2012-02-22 14:50:36