Reputation: 2559
I've been trying to get a div to overlay the content in a div and only that div, not the entire page.
I've tried to use this but it actually covers the entire page. How can I get it only cover the parent?
The HTML looks like:
<div class="document-drag-and-drop-container">
<form novalidate [formGroup]="form">
<div class="col-sm-12 col-md-4 col-lg-3">
<app-textbox label="Name" formControlName="name"></app-textbox>
</div>
<div class="col-sm-12 col-md-4 col-lg-3">
<input type="file">
</div>
<div class="drag-and-drop-overlay hidden">
<h3>Drop Document Here</h3>
</div>
</form>
</div>
css:
.drag-and-drop-overlay{
flex: 1 1 0%;
display: flex;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
margin:10px 25px 25px 25px;
border:9px solid @accent-color4;
border-radius: 5px;
background-color: #C8C8C8;
opacity: 80%;
justify-content: space-around;
}
Upvotes: 2
Views: 463
Reputation: 1218
Just add in CSS position: relative;
for the div you want to cover, to let your overlayer know, which area it can use. I think all you have to do here is to add:
.document-drag-and-drop-container {
position: relative;
}
Upvotes: 2