删除代码

时间:2015-04-27 13:02:26

标签: html css

我的一个div中有一个奇怪的空白区域。

继承人html:

<!-- ### Bottom content container ### -->
<div class="bottom_content">
    <div class="messages"><!-- include problems.php - down devices -->
        <?php include "problems.php";?>
    </div>
</div>
<!-- ### End bottom content container ### -->

当我检查输出时,我注意到""类中的注释后面有两个messages。像这样:

<div class="messages"><!-- include problems.php - down devices -->
" "
    <?php include "problems.php";?>
</div>

继承人messages css:

.messages {
  display:block;
  width: auto;
  padding: 10px;
  padding-top: -10px; /* Added this to try to remove blank space in top of div */
  background: rgb(255, 255, 255); /* The Fallback */
  background: rgba(255, 255, 255, 0.5);
  -moz-border-radius: 10px;
  border-radius: 10px;
  border: #ffffff 1px solid;
}

这会在div的顶部创建一个空行。我该如何删除?我无法在代码中的任何位置找到这两个"",也找不到任何空格。

修改 这是问题.php:

<center><div id="chkerror"></div></center>

使用以下jquery自动填充来自单独的php文件的内容每30秒:

// <![CDATA[
$(document).ready(function() {
$.ajaxSetup({ cache: false }); // This part addresses an IE bug.  without it, IE will only load the first number and will never refresh
setInterval(function() {
 $('#chkerror').load('chkIncludes.php');
}, 30000); // the "30000" here refers to the time to refresh the div.  it is in milliseconds.
});
// ]]>

继续chkIncludes.php的内容:

<?php include "chkLoc1.php";?>
<?php include "chkLoc2.php";?>

chkLoc1.php和chkLoc2.php包含:

<?php
  $host  = "10.10.10.1";
  $loc = ("Location 1");
  $output = array();
        exec("ping -n 1 $host 2>&1", $output);
      //you can use  print_r($output)  to view the output result
      if (count($output) > 7) {
        $output = null;
        $status = ("up");
        $formattedstatus = ("<font color='green'><b>$status</b></font>");
        }
        else {
        $output = null;
        $status = ("down");
        $formattedstatus = ("<font color='red'><b>$status</b></font>");
        };
    echo ("<div class='$status'><a href='#18/58.99940/5.62324' class='locLink' title='Click to show'><b>$loc</b> <i>(IP: $host)</i> is $formattedstatus</a></div>");

?>

1 个答案:

答案 0 :(得分:2)

确保problems.php文件的编码没有BOM(字节顺序标记)。

如果你正在使用Notepad ++,你可以通过以下方式实现: 编码&gt;在没有BOM的情况下以UTF-8编码