php - WordPress、Roots 主题、标题

标签 php css wordpress twitter-bootstrap

一个人为我做了一个网站,我正在努力理解它。它在这里: http://www.brilliantzenaudio.com

请注意,左上角有一个 Logo 图像。我试图了解这是从哪里来的。相关代码似乎部分在 header.php 中,部分在 app.css 中。来自 header.php,

<header class="banner" role="banner">
  <div class="container">

    <div class="row">
      <div class="col-xs-12 col-lg-2">
        <h1 class="logo"><a href="<?php echo home_url(); ?>/"><?php bloginfo('name'); ?>">Brilliant Zen Audio</a></h1>
          ... stuff removed here, other items in header ...             
      </div>
    </div>
  </div>
</header>

并且 app.css 包含如下行。查看上面的 php,我看到有一个类“banner”的元素,很明显有 css 代码解决了这个问题(给它一个颜色、一个位置、边框和 z-index)。我还看到标题标签也被赋予了“横幅”的“Angular 色”。这是否有任何直接的目的,或者是为了屏幕阅读器?

我们还可以看到 php 包含 h1 元素,以及“h1”元素中的“a”元素。 CSS 条目就是为那些东西准备的。我不清楚他们的目的是什么。一方面, Logo 是图像。为什么要放在 h1 标签中?我理解标签的必要性,因为 Logo 应该是可点击的(以返回主页)。但是接下来是链接的文本(我不清楚如何在那里解析 PHP。聪明的是图像被放在那里是因为它是“h1.logo a”css 条目中的背景.

我在下面的评论中添加了一些一般性问题。

.banner { }

header.banner {
   background:#603913;
   position:relative; // question: what does this mean and how will it effect the position of things if I start moving or changing elements?
   border-bottom:solid 1px #fff;  // question: is this bottom border important for some reason?
   z-index:9999; // what does this do?
}
h1.logo {
   margin:0;  // is there a need to define these on h1.logo?
   padding:0;
}
h1.logo a {
   display:block; // what is display:block and how does it affect appearance? How would it affect changes if I change the size or location of the logo?
   text-indent:-9999px;  // what is this?
   background:url(../img/sm-logo.png) no-repeat 0 0;
   width:101px;    // what does it mean when you set the width and height of an <a>
   height:103px;
   margin:0 auto;
}

最佳答案

.banner { }

header.banner {
   background:#603913;
   position:relative; // This is set, so that the position:absolute of h1.logo a will work, and is also needed in order to make the z-index work.
   border-bottom:solid 1px #fff;  // Is responsible for the white line at the bottom of the header. It 's not important, but looks nice...
   z-index:9999; // The z-index property specifies the stack order of an element. An element with greater stack order is always in front of an element with a lower stack order.
}
h1.logo {
   margin:0;  // Yes, because normally an h1 has a top and bottom margin defined, with this setting, you set it to 0.
   padding:0;
}
h1.logo a {
   display:block; // Normally an a element has inline properties. By setting this to block you can use width, margin and other properties which aren't available for inline elements
   text-indent:-9999px;  // The text-indent property specifies the indentation of the first line in a text-block.
   background:url(../img/sm-logo.png) no-repeat 0 0;
   width:101px;    // Sets the width of this a, because it is a block element.
   height:103px;
   margin:0 auto;
}

关于php - WordPress、Roots 主题、标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19449071/

相关文章:

php - 如果unread_bytes == 0,则取消阻塞fread(),而不会使流连接超时

php - 从 php 执行 bash 脚本无需等待

html - 容器内的一组左浮动的固定宽度 div - 奇怪的行为(不规则地中断到下一行?)

jquery - z-index 的问题

html - select/option html tag dotted outline 问题在firefox中

不同页面的 Wordpress 自定义头文件?

php - 将二进制转换为字符串然后再转换回二进制

php - 如何在数字左边加零

html - Revolution Slider 中的透明 BG 和普通文本需要 CSS -- Wordpress

javascript - Wordpress 高级自定义字段,Google map ,一次只打开一个信息窗口