首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将particles.js扩展到后台

将particles.js扩展到后台
EN

Stack Overflow用户
提问于 2018-12-11 00:19:36
回答 1查看 1.9K关注 0票数 1

我买了一个模板,我正在修改它,使我的网站,我是一个设计师,我没有太多的代码,但我想学习,我决定冒险做这样的网络。我想把插件particles.js作为背景,我设法把它放在索引中,但我已经这样放置,我不知道如何扩大它。就像在photoshop里,把它从一个角落拿出来,拖着占据整个背景。

问题是:

下面是particle.js到index.html的div:

代码语言:javascript
复制
<div id="particles-js"
     style="background-color: #000; position: absolute; background-size: cover; background-repeat: no-repeat; background-position: 100%;">
     <canvas class="particles-js-canvas-el"
            style="width: 100%; height: 100%;" width="1617" height="708">
     </canvas>
</div>

它位于脚本之上,在页脚下面。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-12-11 19:50:09

您所需要的只是一些CSS来定位<div>。将其添加到<style>标记中。当你被困在未来的时候,一个好的开始就是W3学校CSS简介。,祝你好运!

代码语言:javascript
复制
/* the #id of your div */
#particles-js {
    /* stay in a constant spot on the page, regardless of scroll */
    position: fixed;
    /* fill the entire page */
    width: 100%;
    height: 100%;
    /* remove the space along the edges */ 
    margin: 0;
    padding: 0;
    /* position it to start at the top of the page */
    top: 0;
    /* put it behind other content */
    z-index: -1;
}

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53715659

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档