2012-12-15 119 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 ; 
}