为什么此徽标会在内容和页面顶部之间创建空间?

时间:2016-10-07 20:14:37

标签: php html css wordpress

感谢您查看我的问题,我开发了一个WordPress主题,并使用PHP为徽标添加了实时自定义(虽然我认为这是一个HTML / CSS问题)

以下是徽标的外观:

enter image description here

在木槌的顶部有一些词语正在创造那个白色的banneer。

以下是处理徽标的HTML:

  <header class="main_menu">
      <div class="container nav_wrapper">
        <nav class="navbar navbar-default">
          <!-- Brand and toggle get grouped for better mobile display -->
          <div class="navbar-header">
            <a class="navbar-brand" href="/">
                            <?php
               // Display the Custom Logo
               the_custom_logo();

                             if(!has_custom_logo()){
                 echo '<img alt="" src="http://placehold.it/350x90" class="img-responsive">';
                             }
                            ?>
            </a>

the_custom_logo();功能打印出图像标签。

关于如何解决这个问题的任何想法?我会 真的 欣赏它。

1 个答案:

答案 0 :(得分:0)

你的问题表明,在木槌顶部有文字,但你没有说明这些文字是什么。

值得检查所有代码,特别是在函数the_custom_logo和hascustomlogo(未打印)中查找任何奇怪的echo或print语句,或检查HTML是否有奇数字符。有时echos可用于定位或打印错误,但它们可能会错误地触发,这可能会导致代码出现问题。

在浏览器中查看来源可能会有所帮助,因为它会告诉您文本出现在代码中的哪个位置可帮助您缩小搜索范围。

希望这有帮助