Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 设置div padding z索引_Css_Html_Particles.js - Fatal编程技术网

Css 设置div padding z索引

Css 设置div padding z索引,css,html,particles.js,Css,Html,Particles.js,是否可以设置特定div填充的z-index 我使用particle.js作为交互式背景,随着鼠标位置的变化而变化。但是,这仅在画布位于堆栈顶部时有效。我正在使用一个div容器作为主要内容,其填充为10% 我希望这个填充在堆栈上向后发送,以便鼠标可以与背景交互。因此我设法解决了这个问题,删除了div的填充和边距,并使用了与先前边距相同的相对位置。然后我将canvas z-index设置为1,container div z-index设置为2。将padding更改为margin以与其背景交互,这样,

是否可以设置特定
div
填充的
z-index

我使用particle.js作为交互式背景,随着鼠标位置的变化而变化。但是,这仅在画布位于堆栈顶部时有效。我正在使用一个div容器作为主要内容,其
填充
10%


我希望这个
填充
在堆栈上向后发送,以便鼠标可以与背景交互。

因此我设法解决了这个问题,删除了div的填充和边距,并使用了与先前边距相同的相对位置。然后我将canvas z-index设置为1,container div z-index设置为2。

padding
更改为
margin
以与其背景交互,这样,元素与其父元素之间的空间就不会通过子元素而变得难以处理。@Randy我刚刚将填充改为边距,但它仍然不允许交互。你能给出一个实际的例子吗?