分享

给Typecho加上导航菜单

 这是名字 2014-07-26

总述

Typecho和Wordpress不一样,很多主题没有显示菜单的选项,但是导航菜单对一个网站的整体布局和浏览效果来看是非常重要的,现在Sven给出一个增加Typecho导航菜单的方法,本方法可以让菜单固定在右上角。

Typecho官网式的精简式菜单

.css代码

这个菜单是在TE官网里面扒下来的, 以下代码加入主题的.css文件中:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
   #te-site-header {
    position: fixed;
    top: 0;
    margin-bottom: 0;
    width: 100%;
    height: 30px;
    background: #FFF;
    border: none;
  }     
  .container {
    margin-right: auto;
    margin-left: auto;
    padding-left: 15px;
    padding-right: 15px; }
    .container:before, .container:after {
      content: " ";
      display: table; }
    .container:after {
      clear: both; }
    }   
  .nav {
    margin-bottom: 0;
    padding-left: 0;
    list-style: none; }
    .nav:before, .nav:after {
      content: " ";
      display: table; }
    .nav:after {
      clear: both; }
    .nav > li {
      position: relative;
      display: block; }
      .nav > li > a {
        position: relative;
        display: block;
        padding: 10px 15px; }
        .nav > li > a:hover, .nav > li > a:focus {
          text-decoration: none;
          background-color: #eeeeee; }
      .nav > li.disabled > a {
        color: #999999; }
        .nav > li.disabled > a:hover, .nav > li.disabled > a:focus {
          color: #999999;
          text-decoration: none;
          background-color: transparent;
          cursor: not-allowed; }
    .nav .open > a, .nav .open > a:hover, .nav .open > a:focus {
      background-color: #eeeeee;
      border-color: #467b96; }
    .nav .nav-divider {
      height: 1px;
      margin: 3px 0;
      overflow: hidden;
      background-color: #e5e5e5; }
    .nav > li > a > img {
      max-width: none; }
  .nav-pills > li {
    float: left; }
    .nav-pills > li > a {
      border-radius: 2px; }
    .nav-pills > li + li {
      margin-left: 2px; }
    .nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus {
      color: white;
      background-color: #467b96; }    
  #te-site-nav {
    float: right; }
    #te-site-nav li a {
      padding: 0 15px;
      line-height: 30px;
      color: #666; }
      #te-site-nav li a:hover {
        background: none;
        color: #999; }
    #te-site-nav li.active a {
      background: none;
      color: #333;
      font-weight: bold; }

在header.php加上:

1
2
3
4
5
6
7
8
9
10
header role="banner" id="te-site-header">
    <div class="container">                
        <ul class="nav nav-pills" id="te-site-nav" role="navigation">
            <li class="active"><a href="http:///">首页</a></li>                    
            <li><a href="http:///category/essay/">随笔</a></li>
            <li><a href="http:///category/website-building/">建站</a></li>
            <li><a href="http:///category/chemistry/">化学</a></li>
            <li><a href="http:///category/default/">未闻花名</a></li>
        </ul>
    </div>

链接地址和内容要根据自己的需求修改。

除非特殊声明,本站文章均属原创。本站使用CC BY-NC-SA 3.0 CN协议发布和共享资源,转载请以相同方式注明,原文来自SVEN的博客

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多