Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 顶部的背景图像元素_Php_Html_Css_Background_Fullscreen - Fatal编程技术网

Php 顶部的背景图像元素

Php 顶部的背景图像元素,php,html,css,background,fullscreen,Php,Html,Css,Background,Fullscreen,我被分配了创建404.php错误页面的任务。我刚刚开始学习一切,这项任务相当困难。到目前为止,我成功地: 设置github+atom 克隆包含一些代码的存储库 设置MAMP+Wordpress并使数据库正常工作 尽量组织所有的术语,尽量不要混淆它们 我从零开始做基本上所有的事情才4天 我设法将这段代码输入到404.php中: > \img\Free黑板背景。jpg“alt=”background“> 404-找不到 | | 这是css: #bg{ 位置:固定; 前-64%; 左

我被分配了创建404.php错误页面的任务。我刚刚开始学习一切,这项任务相当困难。到目前为止,我成功地:

  • 设置github+atom
  • 克隆包含一些代码的存储库
  • 设置MAMP+Wordpress并使数据库正常工作
  • 尽量组织所有的术语,尽量不要混淆它们
我从零开始做基本上所有的事情才4天

我设法将这段代码输入到404.php中:

>
\img\Free黑板背景。jpg“alt=”background“>
404-找不到

  • |
  • |
  • 这是css:

    #bg{
    位置:固定;
    前-64%;
    左-55%;
    宽度:200%;
    身高:200%;
    }
    #bg-img{
    位置:绝对位置;
    排名:0;
    左:0;
    右:0;
    底部:0;
    保证金:自动;
    最小宽度:55%;
    最小高度:55%;
    }
    
    在localhost页面上看起来如下所示:

    我怎样才能使其他元素位于背景之上呢?我读了几个答案,但我现在很困惑,我需要一个具体的提示来说明我的情况。 提前感谢您的帮助!

    试一下

    <?php
    /**
     * The template for displaying 404 pages (Not Found).
    **/
    
    get_header(); ?>
    <div id="bg">
         <img src="<?php echo get_bloginfo('template_directory'); ?> \img\Free-Chalkboard-Backgrounds.jpg" alt="background">
    </div>
    <header class="entry-header">
    <center>
    <h1 class="entry-title">404 - Not found</h1>
    </center>
    </header>
    
    <article id="post-0" class="post error404 no-results not-found">
    <div class="entry-content">
    <p><big>404 - Die Seite konnte nicht gefunden werden.</big></p>
                <?php get_search_form(); ?>
              <!--   <img class="img-responsive" src="<?php echo $logoUrl; ?>" alt="Logo - <?php echo get_bloginfo('name'); ?>">  -->
              <center><img src="<?php echo get_bloginfo('template_directory'); ?> \img\internet-error-404-file-not-found.jpg" alt="404 not-found"  />
              </center>
            </div>
    <!-- .entry-content -->
        </article>
    <!-- #post-0 -->
    <footer>
    
    
       <ul class="list-inline Impressum">
         <li> <a href="https://www.th-nuernberg.de/seitenbaum/impressum/page.html" target="blank">
           <alt=>Impressum</a> </li>
           <li> |
           </li>
         <li> <a href="https://www.th-nuernberg.de/institutionen/hochschulkommunikation/ohm-shop/agb/page.html" target="blank">
           <alt=>AGB</a> </li>
           <li> |
           </li>
         <li> <a href="https://www.th-nuernberg.de/institutionen/language-center/ueber-uns/page.html" target="blank">
           <alt=>Über uns</a> </li>
       </ul>
    
    
    </footer>
    
    <?php get_footer(); ?>
    

    如果我理解正确,你的背景现在是重叠的? 我认为您正在搜索的属性称为z索引

    你可能需要做一些类似的事情

        #bg{
          z-index: -1;
         }
    

    只需在css中添加此样式作为背景“背景位置:顶部中间;“作为旁注:
    标记已被弃用。您不应该使用它们。感谢您的提示,我应该使用什么来代替?感谢您的快速回复,我复制粘贴了您的代码,但结果没有改变。当我重新加载404页面时,我可以看到元素很快弹出,但它们立即消失。bac仍然是一样的。”kground图像占据了整个屏幕,其他的一切都在后面。我发现了这个问题,我想这和我的问题类似,但我不知道如何或在哪里插入这个代码?你只需要在背景div中添加样式。你尝试过了吗?是的,我添加了Jesse de Gans的
    #bg{z-index:-1;}
    到style.css,现在一切都在上面。现在我需要添加一个按钮并更改字体。但这是我今天的一个重要步骤,谢谢!@ChrisChromiumCC我会帮你的谢谢,我将.bg替换为#bg,因为它有
    id=“bg“
    所以我需要用#来调用它?在我把它添加到HKs代码中之后,它似乎起了作用。哎呀!没错,我忘了他用的是身份证背景而不是班级背景。。谢谢你的编辑!!
        #bg{
          z-index: -1;
         }