什么可能导致页面顶部出现空白
我想提供照片以供澄清,但由于在 stackoverflow 中的声誉较低,我无法上传。我使用 Smarty 作为 php 模板引擎。
<html>
<head>
{include file="_js.tpl"}
<title>{$title|escape}</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
{literal}
<style type="text/css">
body{
margin:0;
padding:0;
display: block;
font-family: arial;
}
#main_iframe
{
position: relative;
width: 100%;
height:665px;
border:0px;
}
#iframe_setting{
padding-left: 220px;
background: url('{/literal}{$vir_img}{literal}background.png');
}
#content-wrapper{
height: 665px;
padding-left: 10px;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
$("button#logout").click(function(){
window.location = "{/literal}{$url_app}{literal}?m=account&c=do_logout";
});
});
function go(loc)
{
document.getElementById('main_iframe').src=loc;
}
function go3(loc)
{
document.getElementById('iframeid').src=loc;
}
</script>
{/literal}
</head>
<body>{include file="header.tpl"}
<div style="position:absolute;z-index: 999;">
{include file="sidebar.tpl"}
</div>
<div id="iframe_setting">
<div id="content-wrapper">
{$content}
</div>
</div>
{include file="footer.tpl"}
</body>
</html>
最佳答案
使用 notepad++ ,请确保此文件中包含的所有文件及其本身都是“在没有 BOM 的情况下以 UTF-8 编码”。为此,请按照以下步骤操作:
在 Notpad++ 中 ->(菜单)编码 ->(单击)以不带 BOM 的 UTF-8 编码
如果您使用 UTF8 字符并将文件保存为 UTF8,通常会发生这种情况。然后,将有三个不可见的字符导致该空白。
关于php - 网页顶部的空白区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16474422/