简体   繁体   English

CSS3 Div位置

[英]CSS3 Div Position

I have a loading circle that uses CSS3 Animations. 我有一个使用CSS3动画的加载圈子。 Once the loading circle has finished animating, a empty div fades in. I am having problems placing the empty div ontop of another div. 加载圆环完成动画设置后,一个空的div就会淡入。我在将空div放在另一个div的顶部时遇到了问题。 Any help is much appreciated. 任何帮助深表感谢。

jsFiddle 的jsfiddle

add position:absolute; 添加position:absolute; and top:0; top:0; to box style 框式

.box {
   background: #dedede;
   height: 200px;
   width: 200px;
   animation: in 3s forwards;
   position:absolute;
   top:0;
}

have fun :) 玩得开心 :)

you can use z-index to place elements in 'layers'. 您可以使用z-index将元素放置在“图层”中。

z-index:1000;

Would make an element 1000 layers above 0 respectively. 将使元素分别在0之上1000层。

jsFiddle NEW jsFiddle includes elements above circles. jsFiddle新增jsFiddle包括圆圈上方的元素。

Create a new CSS rule for .wrap as follows: .wrap创建一个新的CSS规则,如下所示:

.wrap{
  float: left;
}

There is no need for you to use z-index property because you already have the DOM working with you, not against you. 不需要使用z-index属性,因为您已经在使用DOM,而不是不利于您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM