统计
  • 文章总数:238 篇
  • 评论总数:608 条
  • 分类总数:7 个
  • 最后更新:2月23日

给TYPECHO加上导航菜单

本文阅读 1 分钟
首页 建站项目 正文
暂无AI摘要
摘要由智能技术生成

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

.css代码 以下代码加入主题的.css文件中:

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

在header.php加上:

  1. <header role="banner" id="te-site-header">
  2. <div class="container">
  3. <ul class="nav nav-pills" id="te-site-nav" role="navigation">
  4. <li class="active"><a href="/">首页</a></li>
  5. <li><a href="/category/essay/">随笔</a></li>
  6. <li><a href="/category/website-building/">分享</a></li>
  7. <li><a href="/category/chemistry/">听哦</a></li>
  8. <li><a href="/category/default/">代码</a></li>
  9. </ul>
  10. </div>

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

请输入图片描述

本文来自投稿,不代表本站立场,如若转载,请注明出处:
-- 展开阅读全文 --
爆款云服务器2核2G4M 6.6元/月起
« 上一篇 09-23
评论者添加IP地址归属地信息
下一篇 » 10-31

发表评论

  • 泡泡
  • 阿呆
  • 阿鲁
  • 蛆音娘

行为验证™ 安全组件加载中...

V注册会员 L评论等级
R3 条回复
  1. oWo  广东省
    2023-01-03     Win 10 /    Chrome

    不会吧,右下角主页和主域名不匹配

    1. 云帆沧海  河北省
      2023-01-03     iPhone /    Safari

      @oWo

      设置的我的展示页

  2. TeacherDu  北京市
    2022-10-06     Win 10 /    Chrome

    有导航会方便的多!

没有更多评论了
AI
AI在线
以确保在用户需要帮助时能够及时提供解答和技术支持
您好,这里是乙未博客 - 一万年太久只争朝夕,请问有什么能帮到您?