Reputation: 813
I made use of a border trick I found somewhere else, basically overlaying a absolute positioned DIV over the content div. It does create the effect though that there is no interaction possible with the original content, i.e. highlighting the text or clicking a button.
.stamp-border {
border-width: 10px;
border-style: solid;
position: absolute;
top: -10px;
left: -10px;
bottom: -10px;
right: -10px;
z-index: 0;
}
I thought adding the z-index should resolve the issue, although it doesn't seem to have any effect. What am I overseeing?
Upvotes: 0
Views: 269
Reputation: 5502
Nothing to worry.... Just add..
pointer-events: none
in your css
Upvotes: 0
Reputation: 43785
It's still unclear what you're looking for. You currently have a div that is unclickable because of the overlay. If you want that, you could use pointer-events: none
as I said in the comments and user-select: none;
. Just note that user-select
has to be vendor prefixed for compatibility.
If you do want it to be clickable, you could get rid of the overlay altogether. The same style can be accomplished simply like this:
<div class="post-cta">
<p>
Lorem ipsum dolor sit amet, consectetur
adipisicing elit. Omnis consequatur deleniti
earum sed distinctio reiciendis vero sapiente
tenetur non natus?
</p>
<input type="submit">
</div>
css:
.post-cta {
background: white;
z-index: 1;
padding: 15px;
border: 10px solid black;
margin: 10px;
}
Live demo of both solutions (click).
Upvotes: 2
Reputation: 596
z-index
will have effect on position:absolute/position:relative
elements only.
As your text and button is not position:absolute/position:relative
elements.
.stamp-border will always above them.
Moreover, z-index
of a chlid element can't smaller then the parent element.
You can create a "container" div to be the parent of both .post-cta and .stamp-border. Like the following.
<div class="container">
<div class="stamp-border"></div>
<div class="post-cta">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Omnis consequatur deleniti earum sed distinctio reiciendis vero sapiente tenetur non natus?</p>
<input type="submit">
</div>
</div>
//CSS Part
.container{
position:relative;
}
Upvotes: 0