1

在布局文件中,我想创建一个像所有网站一样的标题。我有一个标题的图像,我怎样才能将该图像仅用于布局文件中页面的标题部分?

这是我的代码..

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><?php echo page_title; ?></title>
    <?php
    $homeUrl = $this->url('home', array(), array('force_canonical' => true));
    $basePath = $this->basePath();

    $this->headLink(array('rel' => 'shortcut icon', 'type' => 'image/png', 'href' => $this->basePath() . '/img/FantasyFootballLogo.png'))
    ?>

    <?php echo $this->headLink() ?>

</head>

  --Option1:  <header style="background-image:url(/img/ffheader.png)" height="300" width="1000">

              </header>
  --Option2: <header>
               <div style="background-image:url(/img/ffheader.png)"></div>
             </header>

任何人都可以请帮助我如何设置标题?

4

2 回答 2

0

HTML 文件的标题部分并非旨在放置“可见的 HTML”,您应该将容器或正确地排列在正文中,从而将图像固定在页面顶部。这篇文章可以帮助你实现你所需要的: HTML Header With Image And Text

于 2015-04-24T11:11:24.913 回答
0

要在 zf2 中创建标题,您应该使用 viewHelpers 这是维护代码的更好方法

编辑:选项 2 更好地显示您的徽标 ^^

编辑 2:您可能应该使用选项 3:导致此文件对 google 和 co 来说“有意义”

最终编辑:如果您只想为标题添加背景(就像我刚刚意识到 xD),选项 2 也更好。

于 2015-04-24T09:20:15.903 回答