问题描述
我已经借助互联网上的文章完成了一些CSS动画。但是,当我放这个动画时,它遍及整个身体。但我只需要在容器流体 div中使用它。 我怎么包含这个? 我尝试了overflow:hidden,bt,它不起作用。 代码如下。 (我在这里为此指定了特定的身体尺寸,以供您理解。当我将其放在我的网站中时,它遍历了。
body {
width: 1366px;
height: 1366px;
}
.anim_Main {}
.bg {
animation: slide 5s ease-in-out infinite alternate;
background-image: linear-gradient(-60deg,#fed900 50%,#D71920 50%);
bottom: 0;
left: -50%;
opacity: .5;
position: fixed;
right: -50%;
top: 0;
z-index: -1;
}
.bg2 {
animation-direction: alternate-reverse;
animation-duration: 6s;
}
.bg3 {
animation-duration: 7s;
}
.content {
background-color: rgba(255,255,.8);
border-radius: .25em;
Box-shadow: 0 0 0.25em rgba(0,.25);
Box-sizing: border-Box;
/* left: 50%; */
/* padding: 10vmin; */
position: relative;
float: left;
text-align: center;
/* top: 50%; */
/* transform: translate(-50%,-50%);*/
}
.contentNews {
background-color: rgba(255,.25);
Box-sizing: border-Box;
position: relative;
float: left;
text-align: center;
width: 100%;
}
@keyframes slide {
0% {
transform: translateX(-25%);
}
100% {
transform: translateX(25%);
}
}
.widthMax {
width: 100%;
}
<div class="container-fluid">
<div class="content">
<div class="row">
<div class="widthMax">
<h2>Lorem Ipsum</h2>
</div>
<div class="col-sm-5">
<div class="purifier">
<div class="bg"></div>
<div class="bg bg2"></div>
<div class="bg bg3"></div>
</div>
<h3 class="card-title" align="center">Lorem Ipsum..!</h3>
<p class="drop-cap">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,when an unkNown printer took a galley of type and scrambled it to make a type specimen book. It has
survived not only five centuries,but also the leap into electronic typesetting,remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem Ipsum. ”
</div>
<div class="col-sm-7">
<a href="#" target="_blank"><img class="img-fluid" src=""></a>
<br /><br />
<a href="#" class="card-link" target="_blank">
<h5 align="center">Lorem Ipsum</h5>
<p align="center"><i class="fa fa-info-circle"></i> <i>Lorem Ipsum</i>
</a>
</div>
</div>
</div>
</div>
解决方法
将class PremiumService : BaseService(),View.OnClickListener {
private lateinit var mWindowManager: WindowManager
override fun onStartCommand(intent: Intent?,flags: Int,startId: Int): Int {
mWindowManager = getSystemService(Context.WINDOW_SERVICE) as WindowManager
mWindowManager.addView(mFloatingView,params)
return START_STICKY
}
override fun onDestroy() {
mWindowManager.removeView(mFloatingView)
super.onDestroy()
}
}
设置为非静态定位元素的上下文,并隐藏溢出:
public abstract class MyAbstractClass {
protected int x;
protected Integer number;
public MyAbstractClass(int x) {
this.x = x;
}
public int getNumber() {
if (number == null) {
number = generateNumber();
}
return number.intValue();
}
protected abstract int generateNumber();
}
.content
的{{1}}为.content {
position: relative; /* already exists */
overflow: hidden;
,将其更改为position
,因此它将位于.bg
的上下文中。
fixed
absolute
.content