php中的require或include函数存在样式问题。每当我包含一个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">
<?php
include('database.php');
include('login.php');
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Web Design - Free CSS Templates</title>
<meta name="keywords" content="free css templates, web design, 2-column, html css" />
<meta name="description" content="Web Design is a 2-column website template (HTML/CSS) provided by templatemo.com" />
<link href="templatemo_style.css" rel="stylesheet" type="text/css" />
<!--////// CHOOSE ONE OF THE 3 PIROBOX STYLES '''''''-->
<link href="css_pirobox/white/style.css" media="screen" title="shadow" rel="stylesheet" type="text/css" />
<!--<link href="css_pirobox/white/style.css" media="screen" title="white" rel="stylesheet" type="text/css" />
<link href="css_pirobox/black/style.css" media="screen" title="black" rel="stylesheet" type="text/css" />-->
<!--////// END '''''''-->
</head>
<body>
<div id="templatemo_body_wrapper">
<div id="templatemo_wrapper">
<div id="tempaltemo_header">
<span id="header_icon"></span>
<div id="header_content">
<div id="site_title">
<a href="http://www.templatemo.com" target="_parent"><img src="images/templatemo_logo.png" alt="LOGO" /></a> </div>
<p>This is a free CSS website layout from templatemo.com website. Feel free to edit and apply for your websites. Duis vitae velit sed dui malesuad mollis aliquet ligula.</p>
<a href="#" class="detail float_r">Detail</a>
</div>
</div> <!-- end of header -->
浏览器看到的模板源代码:http://www.text-upload.com/read,4081536104820
我编辑的代码(除了包含部分外,没有任何内容被编辑):http://www.text-upload.com/read,4081542128884
您是否使用BOM以UTF-8保存文件?即使是该编码中的"空"文件也会有字节顺序标记,这将导致布局中出现空白。
使用单字节字符集,或者确保保存为不带BOM的UTF-8。