Here's the FIDDLE for play around.
I have created <div class="foo">
and have a generated CSS content using .foo:after
.
I want to have that generated content clickable by setting a link.
If I wrap the .foo
with an anchor it creates a link around .foo
and .foo:after
.
However I want to make the area of .foo:after
clickable, but not the .foo
itself.
Is there a way that I can achieve this using pure CSS? Perhaps changing the markup?
HTML
<div class="container">
<a href="http://example.com">
<div class="foo"></div>
</a>
</div>
CSS
.foo{
width: 400px;
height: 150px;
background-color: #DFBDE0;
}
.foo:after{
content: "";
position: absolute;
background-color: #CB61CF;
width: 100px;
height: 100px;
right: 0;
}
Screeshot