Reputation: 25
I have a thumbnail image you can click to open a full size image as a pop up div.
I want the close button for that pop up to be in the top right corner on the border but not on the image itself. I've attached a screenshot example from another site of what I am trying to do, as well as an example of what mine looks like.
What I want:
What I have:
Here is my HTML:
<div id="blanket" style="display:none;"></div>
<div id="popUpDiv" style="display:none;">
<a href="#" onclick="popup('popUpDiv')"><img src="images/close.png" align=right></a><img src="images/largeimg.jpg" width=551 height=750>
</div>
<h1><a href="#" onclick="popup('popUpDiv')">Click Here To Open The Pop Up</a></h1>
</div>
And my CSS:
#blanket {
background-color:#111;
opacity: 0.65;
position:absolute;
z-index: 9001;
top:0px;
left:0px;
width:100%;
}
#popUpDiv {
position:absolute;
background-color:white;
width:551px;
height:779px;
border:10px solid white;
z-index: 9002;
}
How can I move the close button so that it is on the border and not causing that extra white space due to the button image height?
Upvotes: 2
Views: 18626
Reputation: 4275
Here is the working fiddle
CSS
#blanket {
background-color:#111;
opacity: 0.65;
position:fixed;
z-index: 9001;
top:0px;
left:0px;
width:100%;
height:100%;
}
#popUpDiv {
position:relative;
background-color:white;
width:551px;
margin:10% auto 0 auto;
height:259px;
border:10px solid white;
z-index: 9002;
}
.close{position:absolute; right:-25px; top:-25px;}
Upvotes: 4