php - 网页顶部的空白区域

标签 php html css smarty template-engine

什么可能导致页面顶部出现空白

我想提供照片以供澄清,但由于在 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/

相关文章:

php - 带有随机添加其他图像区域的图像

jquery - 是否有任何事件表明页面正文已加载?

javascript - 在 JavaScript 中隐藏照片并替换另一张照片

javascript 导航器对象未显示在警告框中

php - Symfony 忽略 web/中的目录

php - 当我连接两个表时,不返回空值。返回以前的数据

html - CSS 网格中的纯 CSS 箭头 Div

html - 在 2 列无序列表中对齐并图像和文本彼此相邻

php - apache/linux 版本之间 PHP GLOBALS 的差异

javascript - 如何从 JS 更改动态 CSS 类的 bg 颜色