Friday, December 14, 2012

height:100% problem

The following code does not work in IE because


body,object{
margin:0px;
padding:0px;
border:0px;
}
body{
width:100%;
height:100%;
overflow:hidden;
}


<body>
<object data="a.pdf" type="application/pdf" height="100%" width="100%"></object>
</body>


of the following css specification.

The percentage is calculated with respect to the height of the generated box's containing block. If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the value computes to 'auto'.

So make it to


<!doctype html>
<html>
<head>
<style>
html,body,object{
margin:0px;
padding:0px;
border:0px;
}
html,body{
width:100%;
height:100%;
overflow:hidden;
}
</style>
</head>
<body>
<object data="a.pdf" type="application/pdf" height="100%" width="100%"></object>
</body>
</html>

it will work :)


No comments: