9
Follows a solution that uses a div
to cross-border using pseudo-elements:
.borda {
display:inline-block; position:relative;
}
.borda:before {
content:''; display:block; position:absolute;
height:100%;
left:4px; right:4px; /* tamanho horizontal do cruzamento */
border-left:1px solid #999;
border-right:1px solid #999;
}
.borda:after {
content:''; display:block; position:absolute;
width:100%;
bottom:4px; /* tamanho vertical do cruzamento */
border-bottom:1px solid #999;
}
img {
margin:0 25px 25px 25px; /* tamanho do espaço em branco */
box-shadow:2px 2px 1px #999; /* sombra da imagem */
}
<div class="borda"><img src="http://i.stack.imgur.com/Fpq5z.png"></div>
If all you need is the edge with space, it’s simpler:
.borda {
display:inline-block;
padding:0 25px 25px 25px; /* zero de espaço em cima, 25px no resto */
border:1px solid #999; /* borda em toda a volta */
border-top:none; /* menos em cima */
}
img {
box-shadow:2px 2px 1px #999; /* sombra da imagem */
}
<div class="borda"><img src="http://i.stack.imgur.com/Fpq5z.png"></div>
noticed that the . edge:before it blocks the click of anything inside the div. I have <a> tags inside the div that are locked as if something was on top, when I remove . edge:before it works. You know what can be?
– Alex Martins
I was able to solve the click problem. I put my links inside a div with relative position. Personal thanks
– Alex Martins
@Alexmartins you can put Pointer-Events:No before and after, then they become transparent pro click. is that I usually imagined that the click would be on the whole div, and not only on the image, so I didn’t put it. I think for the user it is better your solution to put the anchor off the edge, there it is more accessible.
– Bacco