Hexo解決頁面過小問題與設置透明背景


使用默認生成的主題,文章寬度過小,而兩遍寬度過大。可以修改

themes\next\source\css\_schemes\Pisces\_layout.styl 

.header{ width: 80%; } /* 80% */
.container .main-inner { width: 80%; } /* 80% */
.content-wrap { width: calc(100% - 260px); }

代碼,改變大小。但加了之后,雖然能夠在電腦上顯示,但手機上的顯示卻會出問題,不能自適應。下面提供我的方法,可以直接復制粘貼我的_layout.styl配置。

.header {
  position: relative;
  margin: 0 auto;
  //width: $main-desktop;
  width: 80%;

  +tablet() {
    width: auto;
  }
  +mobile() {
    width: auto;
  }
}

.header-inner {
  position: absolute;
  top: 0;
  overflow: hidden;
  padding: 0;
  width: 240px;
  background: rgba(255,255,255,0.8);
  box-shadow: $box-shadow-inner;
  border-radius: $border-radius-inner;

  +desktop-large() {
    .container & { width: 240px; }
  }
  +tablet() {
    position: relative;
    width: auto;
    border-radius: initial;
  }
  +mobile() {
    position: relative;
    width: auto;
    border-radius: initial;
  }
}

.main {
  clearfix();
  +tablet() {
    padding-bottom: 100px;
  }
  +mobile() {
    padding-bottom: 100px;
  }
}

.container .main-inner {
  //width: $main-desktop;
  width: 80%;
  +tablet() {
    width: auto;
  }
  +mobile() {
    width: auto;
  }
}

.content-wrap {
  float: right;
  box-sizing: border-box;
  padding: $content-desktop-padding;
  //width: $content-desktop;
  width: calc(100% - 260px);
  background: white;
  min-height: 700px;
  box-shadow: $box-shadow-inner;
  border-radius: $border-radius-inner;

  +tablet() {
    width: 100%;
    padding: 20px;
    border-radius: initial;
  }
  +mobile() {
    width: 100%;
    padding: 20px;
    min-height: auto;
    border-radius: initial;
  }
}

.sidebar {
  position: static;
  float: left;
  margin-top: 300px;
  width: $sidebar-desktop;
  background: $body-bg-color;
  box-shadow: none;

  +tablet() {
    display: none;
  }
  +mobile() {
    display: none;
  }
}

.sidebar-toggle { display: none; }


.footer-inner {
  //width: $main-desktop;
  padding-left: 260px;

  +tablet() {
    width: auto;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  +mobile() {
    width: auto;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}



.sidebar-position-right {
  .header-inner { right: 0; }
  .content-wrap { float: left; }
  .sidebar { float: right; }

  .footer-inner {
    padding-left: 0;
    padding-right: 260px;
  }
}

 

參照:https://anoyer.cn/

透明背景

內容板塊透明

博客根目錄 themes\next\source\css\_schemes\Pisces\_layout.styl 文件 .content-wrap 標簽下 background: white修改為:

1
background: rgba(255,255,255,0.7); //0.7是透明度

菜單欄背景

博客根目錄 themes\next\source\css\_schemes\Pisces\_layout.styl 文件 .header-inner 標簽下 background: white修改為:

1
background: rgba(255,255,255,0.7); //0.7是透明度

站點概況背景

博客根目錄 themes\next\source\css\_schemes\Pisces\_sidebar.styl 文件 .sidebar-inner 標簽下 background: white修改為:

1
background: rgba(255,255,255,0.7); //0.7是透明度

然后修改博客根目錄 themes\next\source\css\_schemes\Pisces\_layout.styl 文件 .sidebar 標簽下 background: $body-bg-color修改為:

1
background: rgba(255,255,255,0.7); //0.7是透明度

按鈕背景

博客根目錄 themes\next\source\css\_common\components\post\post-button.styl 同上修改對應位置為 background: transparent;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM