我已經分配了任務來創建一個404.php的錯誤頁面。我剛開始學習一切,這項任務相當困難。到目前爲止,我有successuflly:頂部的背景圖像元素
- 設立的github +原子
- 克隆包含一些代碼
- 庫建立甲基苯丙胺+ WordPress的,並得到了數據庫工作
- 試圖組織所有的條款,並試圖不要混淆他們
這只是連續4日以來,我從頭開始基本上一切。
我設法得到這個代碼進入404.php:
> <?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(); ?>
這是CSS:
#bg {
position: fixed;
top: -64%;
left: -55%;
width: 200%;
height: 200%;
}
#bg img {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
min-width: 55%;
min-height: 55%;
}
它看起來像這樣的本地主機的網頁上:
我怎樣才能使其他元素在背景之上?我讀了幾個答案,但我現在很困惑,我需要一個具體的提示,以我的情況。 在此先感謝您的幫助!
只是在你的CSS背景添加這種風格「背景位置:頂部中心;」作爲一個附註, –
:'
感謝您的提示,我要用什麼來代替? –