다음을 확인하십시오. example : 저는 귀하의 문제가 CSS와 관련이 없다고 생각합니다. 부모가 비어있는 경우 상위 높이를 기준으로합니다 설정하려면, 그래서 % 높이 0의 100 %가 0이 될 것이다 : check this
코드 예제 : 처음에
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<body>
<style>
#map_canvas{
background-color:#00F;
}
#cont{
background:#F00;
height:200px;
}
</style>
<button onClick="doit1()">Click me to put something in map_canvas</button>
<button onClick="doit()">Click me to make the height 100%</button>
<div id="home" data-role="page">
<div data-role="header">
*my header*
</div>
<div id="cont" data-role="content">
<div id="map_canvas"></div>
</div>
</div>
</body>
<script>
$('#home').live('pagecreate',function(){
$('#map_canvas').css('height','auto');
});
function doit(){
$('#map_canvas').css('height','100%');
}
function doit1(){
$('#map_canvas').html('a')
}
</script>
</html>
#map_canvas , map_canvas –
#map_canvas를 사용하면 스크립트가 작동하지 않습니다 ... 왜 사용하지 않았습니까 # –
js 디버거가 동의합니까? try $ ('# map_canvas'). css ('height', 'auto'); –