我将Google Adsense的广告添加到页面底部。Adsense在我的div内创建一个iframe,并将其广告放入其中。(我更改了iframe的src并添加了1px边框来演示小提琴)我将其用于智能手机和平板电脑用户。
小提琴:http : //jsfiddle.net/mavent/Hpm6L/12/
<div id="mydiv" class="row my_center hidden-print"
style="position:fixed;bottom:0;left:0;right:0;/* height:50px; */
border: 1px solid red;">
<iframe id="aaaa" name="aaaa" width="320" height="50" frameborder="0"
src="http://www.wsj.com" marginwidth="0" marginheight="0" vspace="0"
hspace="0" allowtransparency="true" scrolling="no">
</iframe>
</div>
.my_center {
text-align:center;
}
创建此文件时,mydiv自动具有55px的高度。在这种情况下,广告下方会存在5px的间隙。如果我设置height:50px;
问题可以解决,但又带来了另一个问题(我必须检查用户的宽度是否大于768像素,并向他/她提供表格版本的Google广告等)
那么为什么出现“ 5px”呢?我看不到任何边框,下边距等吗?
我该如何将该div放在底部?
试试这个小提琴。设置您的样式:line-height:0;
HTML:
<div class="row my_center hidden-print" style="position:fixed;bottom:0;left:0;right:0;11height:50px;border: 1px solid red;line-height:0;">
<iframe id="aaaa" name="aaaa" width="320" height="50" frameborder="0" src="http://www.wsj.com" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no"></iframe></div>
CSS:
.my_center {
text-align:center;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句