Hexo 添加背景图片并自适应

修改过程

  1. 在站点配置文件夹source/images/放入你的背景图片

  2. 然后修改主题文件夹themes/source/css/_custom/custom.styl
    PS: 这个文件是存放用户自定义css样式的
    custom.styl开头加入如下的代码

    body {
     background:url(/images/background.jpg);
     background-repeat: no-repeat;
     background-attachment:fixed;
     background-position:50% 50%;
     background-size: cover;
     -webkit-background-size: cover;
     -o-background-size: cover;
     -moz-background-size: cover;
     -ms-background-size: cover;
    
     /*这是设置底部文字, 看个人需要修改*/
      #footer > div > div {
         color:#eee;
     }
    }
    

参考文献

------------------------ The End ------------------------
0%