This is the iframe code for google translation.
<div id="contentframe" style="top: 160px; left: 0px;"> <iframe src="/translate_p?hl=en&ie=UTF8&prev=_t&sl=auto&tl=en&u=http://yahoo.co.jp/&depth=1&usg=ALkJrhjrVT6Mc1tnruB-zgrtu9cyQ1bSeA" name="c" frameborder="0" style="height:100%;width:100%;position:absolute;top:0px;bottom:0px;"></div> </iframe></div>
I tried to do something similar with div and iframe tags, but the html page does not end like google translation.
<div id="contentframe" style="top: 160px; left: 0px;"> <iframe src="http://stackoverflow.com" style="height:100%;width:100%;position:absolute;top:0px;bottom:0px;"></div> </iframe></div>
The IFrame appears right at the top of the page instead of appearing 160px later, as indicated by the div.
I am not sure what is wrong here with my code, which almost matches Google code.
Edit: Adding a position: relative to the label is not suitable as a solution. It compresses the div into a bar with a small height. It also means that the exact position of the page relative to the page cannot be indicated as a result.
html iframe position css-position
John tan
source share