【问题标题】:Solving BOM with UTF-8 encoding使用 UTF-8 编码解决 BOM
【发布时间】:2014-02-16 12:43:43
【问题描述】:

您好,我已经为我的网站设计了一个 Html 标题。它工作正常。我在 PHP 中遇到了与 BOM 相关的问题,该问题已使用 UTF-8 格式解决,因此我可以在我的任何页面中包含标题。  set 现在已经消失了,但我的标题上方仍然存在一个空白的水平间隙。我应该如何摆脱它?

header.php 页面代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" /> 
<title>Untitled Document</title>
    <link href="css/ssHeadFoot.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
    </style>
</head>
<body>

    <table class="style1" cellpadding="0" cellspacing="0">
        <tr>
            <td class="tdTop">&nbsp;
                </td>
        </tr>
        <tr>
            <td class="tdMenu" align="center">
                <ul class="ulMenu">
                    <li><a href="#">Home</a></li>
                    <li><a href="about.asp">About Us</a></li>
                     <li><a href="#">Products</a>
                        <ul>
                        <li><a href="#">Hardware</a></li>
                        <li><a href="#">Plywood</a></li>
                            <li><a href="#">Fabrication</a></li>                        
                            <li><a href="#">Others</a></li>
                        </ul>
                     </li>
                    <li><a href="Contact us.asp">Contact Us</a></li>
                   <li><a href="feedback.asp">Feedback</a></li>
                    <li><a href="login.asp">Log In</a></li>
                    <li><a href="sign.asp">Sign Up</a></li>
                </ul>

            </td>
        </tr>
    </table>

</body>
</html>

包含 header.php 的 demo.php 代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="css/ssHeadFoot.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php include 'header.php'; ?>
</body>
</html>

输出:

【问题讨论】:

  • 您真的删除了 BOM 吗?当您检查浏览器开发工具中的元素时,您会看到什么?
  • 尝试将 UTF-8 添加到字符集。有什么我遗漏的吗?
  • 应该删除 BOM。
  • 你确定这不是 CSS 问题吗?
  • 我正在使用 Dream weaver 我尝试过这样做: 打开您的文档 打开修改菜单 选择页面属性 选择标题/编码子菜单 选择编码下拉菜单并选择 Unicode (UTF-8) 确保复选框“包括 Unicode 签名 (BOM)" 未选中。仍然没有用。任何建议。

标签: php css utf-8 byte-order-mark


【解决方案1】:
猜你喜欢
  • 1970-01-01
  • 2020-12-09
  • 1970-01-01
  • 1970-01-01
  • 2015-11-11
  • 2020-01-25
  • 1970-01-01
  • 2021-03-22
  • 2012-11-07
相关资源
最近更新 更多