2012-12-15 121 views
1

我的問題是關於有2個div有85%的高度和100%的寬度,但只能一次顯示一個。現在是第二個div顯示奇怪。多個div如何具有85%的高度和100%的寬度?

看看這裏,然後選擇(menuslider->選擇下籤證「格拉夫」。) 在那裏,你將看到第二個div不具有寬度100%和85%的高度,我可以在一個簡單的解決這個問題辦法?

Here is the website

下面是HTML:

<div id="mainContent"> 
<div id="googleMap"></div> 
<div id="GraphWindow">dw 
<iframe src="prototype.html" frameborder="" name="" width="" height="" scrolling="no"> Sorry your browser does not support frames or is currently not set to accept them.</iframe> 
</div> 
</div> 

這裏是CSS:

html {height:100%} 
body {height:100%;margin:0;padding:0} 

#mainContent{ 
height:85%; 
width:100%; 
    margin-left: auto ; 
    margin-right: auto ; 
} 

#graphWindow{ 
height:85%; 
width:100%; 
    margin-left: auto ; 
    margin-right: auto ; 
} 
#googleMap { 
height:85%; 
width:100%; 
    margin-left: auto ; 
    margin-right: auto ; 

} 

這裏是JavaScript顯示或隱藏的圖形:

function selectMainView(){ 
    if(document.details.title.value == "map"){ 
     document.getElementById("googleMap").style.display = "block"; 
     document.getElementById("GraphWindow").style.display = "none"; 
    } 
    else{ 
     document.getElementById("googleMap").style.display = "none"; 
     document.getElementById("GraphWindow").style.display = "block"; 
    } 
} 
+0

解決什麼?你從來沒有真正說出你想要的。 – Sparky

+0

我只有Map時才能看到Map,而當我點擊Graph時只有'GraphWindow'。那麼問題是什麼? –

回答

0

設置高度和寬度屬性到iframe

<iframe src="prototype.html" frameborder="" name="" width="100%" height="85%" scrolling="no"> Sorry your browser does not support frames or is currently not set to accept them.</iframe> 
0

div具有ID GraphWindow(大寫G)和你的CSS選擇器是#graphWindow(小寫克)。

更改其中一個讓它們匹配套管。

你也應該改變iframewidth和100%

0

設置#GraphWindowheight#graphWindow ......也許,拼寫錯誤? 仔細檢查你的CSS,區分大小寫!

(提示:嘗試使用 「螢火蟲」,檢查和調試它下一次)

0

修改你的CSS是這樣的:

html {height:100%} 
body {height:100%;margin:0;padding:0} 

#mainContent{ 
height:85%; 
width:100%; 
    margin-left: auto ; 
    margin-right: auto ; 
} 

#GraphWindow{ 
height:85%; 
width:100%; 
    margin-left: auto ; 
    margin-right: auto ; 
} 

#GraphWindow iframe{ 
height:100%; 
width:100%; 
} 

#googleMap { 
height:85%; 
width:100%; 
    margin-left: auto ; 
    margin-right: auto ; 
}