【问题标题】:Adding Menu, Social Media, and custom line into header将菜单、社交媒体和自定义行添加到标题中
【发布时间】:2014-06-28 17:25:53
【问题描述】:

我正在尝试自定义我的标题,使其看起来更像本网站 http://makingmagique.com 上的标题。我喜欢它是固定的和半透明的。也喜欢菜单位于“徽标”旁边,社交媒体按钮都在右侧。如果您能弄清楚如何在底部添加自定义线,则可以加分。 ;) 知道怎么做吗?我目前正在使用 212 个 Wordpress,但对其他主题持开放态度。

有人知道如何自定义这样的标题吗?我的网站是http://beyondblessedblog.com

【问题讨论】:

  • 欢迎来到 SO。请发布您的相关代码,其中包含您现在的标题以及您与另一个标题不同的地方。

标签: menu navigation


【解决方案1】:

以下是标题的相关部分(我直接从makingmagique.com 复制了它们)。如果你还没有,你应该熟悉浏览器的developertools

HTML:

<div id="header-container">
    <div id="header">
        <h1 id="site-title">
            ... <!-- title/logo -->
        </h1>

        <div id="after-header">
            <div class="menu-container" id="primary-menu">
                ... <!-- navigation menus -->
            </div>

            <div class="search" id="search-1">
                ... <!-- search box -->
            </div>

            <div id="social">
                ... <!-- social links -->
            </div>
        </div>

        <div class="clear"></div>
    </div>
    <div class="divider"></div>  <!-- this is the colored line at the bottom -->
</div>

CSS:

#header-container {
  background: none repeat scroll 0 0 rgba(255, 255, 255, 0.9);
  position: fixed;
  width: 100%;
  z-index: 10000;
}
#header {
  margin: 30px auto 0;
  width: 1020px;
}

/* title/logo */
#site-title {
  float: left;
  height: 41px;
  margin-right: 60px;
  position: relative;
  width: 265px;
  z-index: 300;
}

#after-header {
  float: left;
  height: 17px;
  margin-bottom: 2px;
  padding-top: 26px;
  width: 695px;
}

/* navigation menus */
#primary-menu {
  display: inline-block;
  float: left;
}

/* search box */
#after-header .search {
  display: inline-block;
  float: left;
  line-height: normal;
}

/* social links */
#social {
  display: inline-block;
  float: right;
  font-size: 13px;
  line-height: normal;
  margin: 0;
  padding: 2px 0 0;
  text-align: right;
}

.clear {
  clear: both;
}

/* this is the colored line at the bottom */
.divider {
  background: linear-gradient(to right, #c6e0e5 0%, #ffcdce 100%) repeat scroll 0 0 rgba(0, 0, 0, 0);
  height: 5px;
  position: relative;
  width: 100%;
  z-index: 200;
}

附:菜单动画和悬停状态为another kettle of fish

【讨论】:

    猜你喜欢
    • 2022-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-24
    • 1970-01-01
    相关资源
    最近更新 更多