我有一个Div下面是一个按钮,因为我的屏幕尺寸改变Div的高度变化,因为按钮改变它的位置有时它隐藏在Div后面,因为我提供了z-index。即使屏幕尺寸发生变化,如何使按钮的位置相对于Div固定?
这是我的HTML代码: -
<div class="row" id="event">
<div class="col-lg-1 col-md-1 col-xs-1"></div>
<div class="col-lg-10 col-md-10 col-xs-10 ">
<section *ngFor="let event of events; let i = index" [style.backgroundColor] = "colorsArray[i]" class="eventSectionCSS">
<legend class="legendCSS"> {{event.title}}</legend>
<br>
<div class="row" style="margin-left: 15px;" >
<div class="col-lg-6 col-md-6 col-xs-6" style="display: inherit;" >
<div class="row" >
<div class="col-md-6 col-lg-6 col-sm-6 col-xs-6">
<h2 class="presenterNameCSS" >{{ event.SMEPresentedByFirstName | uppercase}} </h2>
</div>
<div class="col-md-6 col-lg-6 col-sm-6 col-xs-6" style="margin-left: -10px;" >
<h2 class="presenterNameCSS" > {{ event.SMEPresentedByLastName | uppercase}} </h2>
</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3" ></div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3" id="image__event_both" >
<div class="col-lg-6 col-md-6 col-xs-6">
<div class="flip-container" ontouchstart="this.classList.toggle('hover');">
<div class="flipper">
<div class="front">
<img id="image__1" (click) = "clickToShare()" src="../assets/img/Fwd Icons/share.png" >
</div>
<div class="back">
<div class="row" >
<section class="widget sharing_events_widget">
<share-buttons (click) = "closeShareIt(i)" [url]="'http://mentoriaweb.azurewebsites.net/#/app/Login'"
[count]="false"
[totalCount]="true"
[defaultStyle]= "true"
(popUpClosed) = "true"
[google]="googleInner"
[pinterest]="false"
[linkedIn]="false"
[tumblr]="tumblrInner"
[reddit]="false"
[stumbleUpOn]="false">
</share-buttons>
</section>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-xs-6">
<img id="image__2" (click) = "notifyMe(event.uid)" src="../assets/img/Fwd Icons/notify.png" >
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-12 col-xs-12 presenterImageDivCSS " >
<img style="margin-left: 31px;" src="assets/img/avatar.png">
</div>
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<p class="smeSnippetCSS" > {{event.snippet}} </p>
<a style="color:#fff;" >...Read more</a>
</div>
<div class="col-lg-3 col-md-3 col-sm-12 col-xs-12 dashed_height"style="">
<div class="date1" >{{event.eventDate*1000 | date:'dd'}}</div>
<div class="date2"><b>{{event.eventDate*1000 | date:'MMM' | uppercase}}</b> <br>
<p class="date3">{{event.eventDate*1000 | date:'yyyy'}}</p>
</div>
<div class="date4"> <b>{{ event.eventDate | date:'hh:mm a'}}</b></div>
</div>
</div>
<br>
</section>
<div>
<button class="btn btn-primary width-100 mb-xs" id="sme_register" role="button" ><span class="sme_buttonn"><b> Register</b></span> </button>
</div>
</div>
<div class="col-md-1 col-lg-1 col-xs-1"></div>
</div>
答案 0 :(得分:0)
您可以通过使用位置相对来实现此目的。固定位置分别对应于屏幕。
你更新的小提琴没有显示实际上是什么。我看不到固定在按钮上的位置。