I'm facing a little issue and hoping for a quick solution as I can't seem to figure out the problem.
Recently, I came across an answer on how to create a complex CSS shape like a speech bubble. Inspired by it, I tried implementing something similar in my code. However, I'm struggling with getting the :before pseudo element to display outside the "parent" div. My goal is to make it look like a speech bubble, which requires the element to extend beyond the boundaries of the div.
Below is the code snippet:
HTML
<div class="image">
<img class="test" src="http://fc00.deviantart.net/fs71/f/2011/322/e/2/e292b11555866aec8666ded2e63ee541-d4gl4vg.png" alt="leopard" />
</div>
CSS
body {
background-color: #333;
}
.image {
position:relative;
width:360px;
background:orange;
border-radius: 15px;
overflow: hidden;
margin-left: 15px;
}
.image:before {
position: absolute;
z-index: 1;
content: '';
background-color: #fff;
border: solid 0 transparent;
top: 50px; left: -1.25em;
width: 5em; height: 1em;
transform: rotate(45deg) skewX(75deg);
-moz-box-shadow: inset 0 0 5px #000000, -3px 0px 2px 6px #000;
-webkit-box-shadow: inset 0 0 5px #000000, -3px 0px 2px 6px #000;
box-shadow: inset 0 0 5px #000000, -3px 0px 2px 6px #000;
}
.test {
display:block;
width:100%;
}
You can view the codepen demo here.
Any helpful insights would be greatly appreciated.