Applying a mock bottom-border to a rotated div - html

I'm currently using the CSS3 rotate value to give the appearance of an arrowhead for modal boxes. I'm now in a situation where I need to create an full arrowhead with a bottom border. Since this is just a div that's rotated at a 45° angle, applying another border to either of the two sides wouldn't solve the problem.
My first thought was to apply some styling the div's :after pseudo selector and vertically center it. For some reason though it's inheriting the rotate value. I've tried setting the value to none and tried to manually adjusting the rotation angle but to no avail. Any idea on how to get this border to reset horizontally straight?
Through Harry's suggestion I set the angle of the :after selector to -45deg and top value to 50%. The only problem now is that it doesn't fully expand to the left and right of the div. Any ideas?
.arrow {
background-color: transparent;
border-top: 2px solid #c7c7c7;
border-left: 2px solid #c7c7c7;
position: relative;
height: 18px;
width: 18px;
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
.arrow:after {
content: "";
background: #c7c7c7;
display: inline-block;
position: absolute;
top: 50%;
height: 2px;
width: 100%;
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
}
<div class="arrow"></div>

Using CSS Transforms:
You can create a full arrowhead with bottom border using the approach adopted in the below snippet. Here, the arrowhead is created by the :after element while the line at the bottom is created using the parent container. The rotation axis is fixed using the same transform-origin for parent & child.
The shape created using this approach should be able to adapt itself to all dimensions without needing any tweaks to the positioning (hover the arrow in snippet to see it in action).
.arrow {
position: relative;
height: 25px;
width: 25px;
border-bottom: 2px solid #c7c7c7;
}
.arrow:after {
position: absolute;
content: "";
bottom: -1px; /* half of border top */
left: -2px; /* equal to border left */
height: calc(100% / 1.414); /* division by 1.414 because parent has to be larger */
width: calc(100% / 1.414);
border-top: 2px solid #c7c7c7;
border-left: 2px solid #c7c7c7;
transform-origin: left bottom;
transform: rotate(45deg);
}
/* Just for demo */
.arrow { transition: all 1s; }
.arrow:hover { height: 50px; width: 50px; }
<div class="arrow"></div>
Using SVG:
You could also have a look at using SVG for creating such shapes because it is much more easier to do so and the output is also responsive. All we need is one path element which creates the shape by connecting the coordinates provided within the d attribute. The M command moves the pen to the specified coordinate whereas the L command draws line from the previous point to the one specified after the command.
svg {
width: 25px;
height: 18px;
}
path {
stroke: #c7c7c7;
stroke-width: 2;
fill: transparent;
}
/* Just for demo */
svg{ transition: all 1s; }
svg:hover{ width: 50px; height: 36px; }
<svg viewBox='0 0 50 50' preserveAspectRatio='none'>
<path id='arrowhead' d='M0,48 L25,2 50,48z' vector-effect='non-scaling-stroke'/>
</svg>
Using Gradients:
The below approach using linear-gradient which would also work and would require only a single element but it has lesser browser support and is suited only for fixed size containers. Because the gradients use percentage values, bottom border tends to get thicker as container's dimensions change (thus rendering it useless for responsive designs).
.arrow {
position: relative;
height: 18px;
width: 18px;
border-top: 2px solid #c7c7c7;
border-left: 2px solid #c7c7c7;
background: linear-gradient(to left top, transparent 50%, #c7c7c7 50%, #c7c7c7 60%, transparent 60%);
transform: rotate(45deg);
}
/* Just for demo */
.arrow { transition: all 1s; }
.arrow:hover { height: 50px; width: 50px; }
<div class="arrow"></div>

Related

Right banner arrows purely in CSS

I'm trying to recreate these arrows in CSS for a website I'm redesigning to be responsive. These two guys were done with static images but I'd like them to be pure CSS.
This is a sprite that was used for mouseover replacement. The bottom is the mouseover state. The background behind the arrow needs to be transparent.
I thought it would be a simple div with a p or heading tag inside:
<div class="arrow_box">
<p>UTILITIES</p>
</div>
I've searched for examples everywhere and everything I've tried to modify never lets me seem to have full control of the width and height of the element. The width (with the arrow) is 114px. The height (of a single state) would be 29px.
I've played with this for the better part of an hour trying to get it properly sized but nothing seems to work. http://codepen.io/anon/pen/bpBGQL My lack of knowledge on how this works is partially to blame.
So the trick, here, is being able to control the height correctly. Here, I've got the text in a span with a line-height : 0, and padding:15px. Now, we have precisely 30px of height, and can use an ::after pseudo element to fabricate the arrow. The width will be set by the text content, but can be defined with an explicit width rule, as well.
<div class="arrow"><span>text</span></div>
.arrow{
display:inline-block;
height:auto;
background-color:orange;
}
.arrow span{
display:inline-block;
line-height:0;
padding:15px;
color:white;
}
.arrow::after{
width: 0;
height: 0;
position: absolute;
right:0
top: 0;
border-top: 15px solid transparent;
border-bottom: 15px solid transparent;
border-left: 15px solid orange;
content: "";
}
Add whatever colors / hover states you require. You can see some basic rules in the working fiddle.
Fiddle
You can do this with :after pseudo element. You can change color of pseudo element on hover state like this .arrow_box:hover:after
* {
box-sizing: border-box;
}
p {
margin: 0;
padding-left: 10px;
}
.arrow_box {
background: #627680;
display: block;
color: white;
position: relative;
height: 30px;
line-height: 30px;
width: 114px;
transition: all 0.3s ease-in;
}
.arrow_box:after {
content: '';
height: 0;
width: 0;
position: absolute;
top: 0;
right:0;
transform: translateX(100%);
border-bottom: 15px solid transparent;
border-top: 15px solid transparent;
border-left: 20px solid #627680;
border-right: 15px solid transparent;
transition: all 0.3s ease-in;
}
.arrow_box:hover {
background: #2A92C2;
}
.arrow_box:hover:after {
border-left: 20px solid #2A92C2;
}
<div class="arrow_box">
<p>UTILITIES</p>
</div>
did you consider gradient backgrounds ?
body {
background: linear-gradient(45deg, gray, lightgray, gray, lightgray, gray, lightgray, gray, lightgray, gray, lightgray, gray, lightgray);
/* demo purpose only */
}
.arrow {
text-transform: uppercase;
/* optionnal */
padding: 3px 1.5em 3px 0.5em;
color: white;
background: linear-gradient(225deg, transparent 0.6em, #627680 0.6em) top no-repeat, linear-gradient(-45deg, transparent 0.6em, #627680 0.6em) bottom no-repeat;
background-size: 100% 50%;
/* each gradient draws half of the arrow */
}
.arrow:hover {
/* update gradient color */
background: linear-gradient(225deg, transparent 0.6em, #2A92C2 0.6em) top no-repeat, linear-gradient(-45deg, transparent 0.6em, #2A92C2 0.6em) bottom no-repeat;
background-size: 100% 50%;
}
<span class="arrow"> Utilities</span> <span class="arrow"> testing</span>
You may also want to take a look at Responsive Arrow Breadcrumb Navigation for breadcrumbs and imbricated arrows or Create dynamic arrow-like shape with CSS
Does this pen provide what you need?
http://codepen.io/anon/pen/dMOPmV (may require some pixel pushing to get it perfect)
It just required adjusting:
border-width: 27px;
margin-top: -35px;
and adding a hover state for the main element and before element.

Slantic shadow of circle in CSS [duplicate]

So I know how to do a basic box shadow with CSS3. You can see that in the top of the graphic below.
The effect I'm trying to achieve is a 3D box shadow, as shown in the bottom of the graphic below.
Any ideas on how to do this with CSS3 box shadows?
Unfortunately box shadows are effectively just flat layers. However you can apply multiple box shadows to create this effect.
.box-shadow-3d{
box-shadow: 1px 1px 0px #999,
2px 2px 0px #999,
3px 3px 0px #999,
4px 4px 0px #999,
5px 5px 0px #999,
6px 6px 0px #999;
}
you can use pseudo element for as shadow
div {
background: black;
height: 100px;
width: 100px;
position: relative;
}
div:after,
div:before {
content: '';
background: grey;
position: absolute;
}
div:after {
width: 100%;
height: 20px;
left: 10px;
bottom: 0;
transform: translatey(100%) skewx(45deg);
}
div:before {
width: 20px;
height: 100%;
right: 0;
transform: translatex(100%) skewy(45deg);
top: 10px;
}
<div></div>
Here is a real 3D shadow using perspective and pseudo-element :before.
body {
background: lightblue;
}
.foo {
position: relative;
display: inline-block;
-webkit-perspective: 1000px;
-moz-perspective: 1000px;
persepctive: 1000px;
margin: 20px;
margin-top: 50px;
}
.foo .box {
transform: rotateY(-40deg);
height: 350px;
width: 250px;
background-color: black;
}
.foo:before {
content: "";
top: -15px;
position: absolute;
width: 50px;
height: 375px;
background-color: grey;
transform: translateX(215px) translateY(2.7px) rotateY(55deg)
}
<div class="foo">
<div class="box"></div>
</div>
You can stack the horizontal/vertical offsets of several box-shadows, each slightly bigger than the previous one. The more shadows you add, the more pronounced the effect. Here is a fiddle example.
div {
background: black;
height: 100px;
width: 100px;
box-shadow: 0 01px gray,
01px 0 gray,
01px 02px gray,
02px 01px gray,
02px 03px gray,
03px 02px gray,
03px 04px gray,
04px 03px gray,
04px 05px gray,
05px 04px gray,
05px 06px gray,
06px 05px gray;
}
I had some problems with these two options, so I adapted some diagonal gradients from Lea Verou's excellent book CSS Secrets. I thought about creating a gradient inside a right and bottom border via border-image, but that property does not allow edge targeting, à la border-right-image, etc.
So, I settled on using a pseudo element with two truncated corners, which seems to work pretty well. You have to be careful to adjust the width of the gradient to be 1.414 the size of half the padding, since this would be the diagonal of a square (square root of two). Also, since that's a pseudo element, be careful of the right placement. Interested to hear what you folks think.
div {
background: #bbb;
padding: 1em 1.2em;
width: 50%;
margin: 0 auto;
color: #111;
font: 150%/1.2 Georgia, Palatino, Times, serif;
position: relative;
}
div:after {
content:" ";
position:absolute;
top:0;
left: 0;
width:100%;
height:100%;
padding: 1.42em; /* (square root of gradient position) */
background: #000; /* Fallback if not supported */
background: linear-gradient(-135deg, transparent 2em, #000 0) top right,
linear-gradient(#000, #000) padding-box bottom right,
linear-gradient(45deg, transparent 2em, #000 0) bottom left;
/*I have avoided adding -webkit-, -moz and -0 prefixs for linear-gradient. You may put them in later to be extra safe*/
background-size: 50% 50%; /* There is no reason to paint the upper left quadrant, so I didn't. */
background-repeat: no-repeat;
-webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box;
/* Many people use border-box as default these days. Unfortunately, the box cannot be sized using border-box settings with the combination of padding in ems and percentages. So this is reset to content-box, just in case. */
z-index: -1; /* To keep the shadow behind the div*/
<div>This is a short sentence to demonstrate that our little div is responsive.</div>
Here's a little implementation, inspired by #Vitorino fernandes, in stylus...
offset = 10
border = 3
.offsetbox
margin offset
padding offset
text-align center
box-shadow inset 0 0 0 unit(border,px) black
background white
display inline-block
position relative
&:after,
&:before
content ''
background black
position absolute
&:after
width 100%
height offset
transform translatey(100%) skewx(-45deg)
right (offset/2)
bottom 0
&:before
height 100%
width offset
transform: translatex(-100%) skewy(-45deg)
left 0
top (offset/2)
I added some clip paths to #Vittorino fernandes code, to avoid white space between pseudos and make it sharper.
I added some 1px adjustments to avoid bad svg rendering problems.
You can use the variable called shadow-dimension to set the shadow width and height.
I Put it on a codePen:
https://codepen.io/silviamalavasi/pen/XWqeWEq
:root {
--shadow-dimension: 20px;
--blue: #0039a6;
}
.box-container {
position: relative;
}
.box-container>div {
border: 2px solid var(--blue);
}
.box-container>div:after, .box-container>div:before {
content: '';
background-color: var(--blue);
position: absolute;
}
.box-container>div:before {
width: calc(var(--shadow-dimension) + 1px);
height: calc(100% + 100px + 1px);
left: calc(var(--shadow-dimension) * -1);
transform: skewy(-45deg);
top: calc(0.5*var(--shadow-dimension));
clip-path: polygon(0% 0%, 100% 0%, 100% calc(100% - 100px - 2px + var(--shadow-dimension)), 0% calc(100% - 100px - 2px));
}
.box-container>div:after {
width: calc(100% + 100px);
height: calc(var(--shadow-dimension) + 1px);
left: calc(-0.5*var(--shadow-dimension) - 100px);
bottom: 1px;
transform: translateY(100%) skewx(-45deg);
clip-path: polygon(100px 0%, 100% 0%, 100% 100%, calc(100px + 2px) 100%);
}

CSS design for cancel/cross

I am trying to design the following image
The following has been my attempt so far, but i am just not able to get the content "x" to reach the four corners of the div.
HTML
<div id="cancel">X</div>
CSS
#cancel{
float: right;
border: 1px solid yellow;
font-family: 'Helvetica', 'Arial', sans-serif;
font-weight: lighter;
font-size: 3em;
width: 10%;
text-align: center;
background-color: #d5d6da;
color: white;
width: 12%;
cursor: pointer;
}
The following image is the output i was to be get to so far
I'd use a bit of scale for it - and a pseudo element :
Example
#cancel {
width: 0.9em;
height: 0.9em;
position: relative;
font-family: helvetica, arial, sans-serif;
font-weight: lighter;
font-size: 3em;
color: white;
background-color: #d5d6da;
cursor: pointer;
}
#cancel:after {
content: 'X';
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%,-50%) scaleX(1.2);
transform: translate(-50%,-50%) scaleX(1.2);
}
Or without any fonts and full control over how it looks :
Demo
#cancel {
width: 40px;
height: 40px;
position: relative;
background-color: #d5d6da;
cursor: pointer;
}
#cancel:before, #cancel:after {
content: '';
width: 110%;
height: 3px;
position: absolute;
top: 50%;
left: 50%;
background: white;
}
#cancel:before {
-webkit-transform: translate(-50%,-50%) rotate(45deg);
transform: translate(-50%,-50%) rotate(45deg);
}
#cancel:after {
-webkit-transform: translate(-50%,-50%) rotate(-45deg);
transform: translate(-50%,-50%) rotate(-45deg);
}
Here we create two pseudo elements (:before and :after) that are rectangles, both having a width of 110% of the parent and a few pixels height. They are then centered horizontally and vertically inside the parent with absolute positioning and a transform: translate. Last step is to make one rotate 45 degrees and the other the same amount but in the opposite direction. This will make them form a cross - the more width the elements are given, the closer they will be to the corners of the parent (at 141% they will be touching exactly since this is the length of the diagonal compared to it's the width).
I might recommend using an image file such as an svg so that you get a consistent look across all browsers. If you use text like an "X" or a multiplication sign, you might get an unexpected result if the user doesn't have the same fonts installed as you do.
Here is a live example of how you could go about using inline svg. Of course if you want to reuse the icon, you should use an img tag with an external .svg file instead:
Screenshot:
Demo:
#container {
width: 50px;
height: 50px;
background-color: gray;
}
<div id="container">
<svg version="1.1" id="Layer_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="47" viewBox="0 0 14 14" overflow="visible" enable-background="new -1.301 -0.015 17.553 14.978" xml:space="preserve">
<g>
<line fill="none" stroke="#FFFFFF" stroke-width="2" x1="1" y1="1" x2="14" y2="14" />
<line fill="none" stroke="#FFFFFF" stroke-width="2" x1="14" y1="1" x2="1" y2="14" />
</g>
</svg>
</div>
You are looking for the Unicode Character 'MULTIPLICATION SIGN'. Perhaps there is a more elegant solution. This should work.
HTML
<div class="close"></div>
CSS
.close {
height: 100px;
width: 100px;
background-color: #2980b9;
border-radius: 5px;
}
.close:after {
position:relative;
content:"\d7";
font-size:235px;
color:white; /* #c0392b; */
font-weight:bold;
top:-100px;
left:-24px
}
JSFiddle
http://www.fileformat.info/info/unicode/char/00d7/index.htm
I like the svg solution as it will scale nicely, but if you want a CSS only solution, you can achieve something "similar" by doing this:
Create the box and assign it a relative position.
Use the pseudo-elements ::before and ::after to create the X (by positioning them absolutely, using the top border, and rotating them 45 and -45 degrees).
Here is a sample on how to do it:
.cancel {
position:relative;
width:100px;
height:100px;
background:#d0d0d0;
}
.cancel::before, .cancel::after {
content:"";
position:absolute;
top:calc(50% - 5px);
left:0px;
width:100%;
border-top:10px solid white;
transform:rotate(45deg);
transform-origin: 50% 50%;
}
.cancel::after {
transform:rotate(-45deg);
}
<div class="cancel"></div>
Some good things about this solution:
It can be easily animated using CSS3 transitions/animations (for example animate the X when clicked);
It "scales" a little: as it uses percentages for the ::before and ::after, the X grows proportionally if you grow/shrink the size of the .cancel box. Example.
Some cons about this solution:
It doesn't scale as nicely as the SVG.
You many need to use prefixes to make it work on some browsers.
Not sure if this is what you're looking for - but perhaps try a CSS solution with no "X" content? This solution is built with four div's that are all shaped like triangles with the help of CSS borders. Depending on how you position the triangles, your "X" in the middle can be as thin or as thick as you like, and the "X" will go all the way to the corners. The positioning in what I've posted isn't incredibly elegant, but you can get around this using floats and padding. I hope this helps!
HTML:
<div class="crossBox">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
CSS:
.crossBox div {
display: inline-block;
}
.crossBox div:first-child {
width: 0;
height: 0;
border-top: 58px solid blue;
border-left: 58px solid transparent;
border-right: 58px solid transparent;
background-color: transparent;
border-bottom: none;
position: relative;
top: -34px;
left: 5px;
}
.crossBox div:nth-child(2) {
width: 0;
height: 0;
border-left: 58px solid blue;
border-top: 58px solid transparent;
border-bottom: 58px solid transparent;
background-color: transparent;
border-right: none;
position: relative;
left: -118px;
top: 30px;
}
.crossBox div:nth-child(3) {
width: 0;
height: 0;
border-right: 58px solid blue;
border-top: 58px solid transparent;
border-bottom: 58px solid transparent;
background-color: transparent;
border-left: none;
position: relative;
left: -116px;
top: 30px;
}
.crossBox div:nth-child(4) {
width: 0;
height: 0;
border-bottom: 58px solid blue;
border-left: 58px solid transparent;
border-right: 58px solid transparent;
background-color: transparent;
border-top: none;
position: relative;
top: 36px;
left: -239px;
}

css3 arrow with drop shadow

Hey currently I have this css to produce a css arrow but I cannot seem to get a drop shadow on it any ideas
.arrow {
width: 0px;
height: 0px;
border-style: solid inset;
border-width: 10px 78px 0 78px;
border-color: #000 transparent transparent transparent;
z-index: 1;
}
I have dabbled with :after and :before but with no success
Since your arrow is going to be placed under a solid rectangle, this can help you
.demo {
position: absolute;
top: 50px;
left: 0px;
width: 200px;
height: 50px;
clip: rect(0px 400px 100px 0px);
}
.demo:after {
content: "";
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
background-color: black;
-webkit-transform: translate(-90px, -45px) skew(80deg) rotate(-5deg);
-moz-transform: translate(-90px, -45px) skew(80deg) rotate(-5deg);
transform: translate(-90px, -45px) skew(80deg) rotate(-5deg);
box-shadow: 30px 1px 6px blue;
}
fiddle compared with your original arrow
The problem is that the shadow can not go upwards, but usually this design wouldn't need that anyway.
Also, the base div is highly distorted, so you will need to set the shadow by trial and error.
http://css-tricks.com/triangle-with-shadow/
I think that's what you're looking for, it explains two methods to get a shadow on arrows with CSS.
One is to use a unicode triangle character and apply a shadow to that, the other is using CSS trickery with the :after selector and CSS transform.

Dynamic shapes with CSS

I'm working on a creative project whereby I want to add 'triangles' to box elements to get a speech bubble effect and still apply an opacity to each element as shown below:
I can get the blocks to display correctly with a 1px boarder on the right and bottom of each element. This, however, does not include the arrows on the heading element. When I add the arrows, using .heading:before, the result is as shown below:
As you can see, the original border remains, breaking the arrow and its corresponding element.
My HTML is as follows:
<li class="heading">
<div class="text_contain_head">
<h1>Heading</h1><p>Subheading</p>
</div>
</li>
<li class="options">
<div class="text_contain">
<h2>Option 1</h2><p>Description</p>
</div>
</li>
<li class="options">
<div class="text_contain">
<h2>Option 2</h2><p>Description</p>
</div>
</li>
<li class="options">
<div class="text_contain">
<h2>Option 3</h2><p>Description</p>
</div>
</li>
<li class="options">
<div class="text_contain">
<h2>Option 4</h2><p>Description</p>
</div>
</li>
and here's the CSS for .options:
.options {
position: relative;
padding-bottom: 25%;
height: 0;
width: 25%;
background-color: rgba(0, 0, 0, 0.25);
border-right: 1px solid #FFF;
border-bottom: 1px solid #FFF;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
float: left;
}
and here's the CSS for .heading:
.heading {
position: relative;
padding-bottom: 25%;
width: 75%;
background-color: rgba(0, 0, 0, 0.6);
border-right: 1px solid #FFF;
border-bottom: 1px solid #FFF;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding-left: 40px;
padding-right: 40px;
float:left;
}
.heading:before {
content: "\0020";
display: block;
border: solid 20px transparent;
border-right-color: rgba(0, 0, 0, 0.6);
position: absolute;
top: 50%;
right: -40px;
margin-top: -20px;
z-index: 1002;
transform:scale(1,1.5);
-ms-transform:scale(1,1.5);
-webkit-transform:scale(1,1.5);
}
P.S. I use :after to add a white triangle with a 1px offset underneath the :before to replicate the border around the triangles.
In the end, I want to be able to keep the elements' opacities (due to the background image) and still be able to 'remove' the original border where the arrows overlap.
I'm stumped, as such any and all advice would be most apreciated
here is a jsfiddle of what I have so far: http://jsfiddle.net/N2nZ6/1/
I have put up a fiddle of my own: http://jsfiddle.net/Pevara/8WBcQ/
It was not easy, but i think i got away with it, but with some limitations:
- I had to add two empty nodes inside your .heading for the arrows. I know it isn't pretty, but I tried without them and just couldn't get it to work.
- I had to set a fixed width. It might be possible to do with percentages, but as it requiers very exact positioning, I did not even try... (percentages and exact postioning are a no go in my experience)
How does it work:
- I turn the extra nodes into a square and rotate them 45deg to make them look like an arrow point
- I position them absolute over the edge of the .heading, to cover up the border.
- I set them to overflow hidden to prevent the :after and :before overflowing
- I set the background image on the :before, counter rotate 45deg, and position exactly to line up with the background image of the ul
- I add another :after with a the same semi-transparent background color as the .heading to make the backgrounds match exactly.
It is not exactly clean, and it will take some fiddling with the positioning, but it works (in chrome, other browsers might need some prefixes). I don't dare to look at the result in older IE's. Might not be useable in a real life website, but as a proof of concept...
In real life I would probably go for a sprite image with the borders and arrows already in place, and position the li's on top of them.
And because SO insists, here is a part of the css:
.arrow-down {
position: absolute;
display: block;
overflow: hidden;
width: 50px;
height: 50px;
-webkit-transform: rotate(45deg);
top: 200px;
left: 300px;
background-color: rgba(0, 0, 0, .5);
margin-left: -25px;
z-index: 5;
border: 1px solid #fff;
border-left: none;
border-top: none;
}
.arrow-down:after {
content:' ';
display: block;
width: 300px;
height: 300px;
-webkit-transform: rotate(-45deg);
background-repeat: no-repeat;
background-image: url(http://www.placekitten.com/900/600);
background-position: -114px -77px;
z-index: 1;
position: absolute;
top: -100px;
left: -150px;
}
.arrow-down:before {
content:'';
background-color: rgba(0, 0, 0, .5);
z-index: 2;
position: absolute;
top: -5px;
left: -5px;
bottom: -5px;
right: -5px;
}
I think that achieving this effect is a bit complicated which can be done by making the triangle opaque and keeping the same background image(using appropriate position) for the triangles which would cover the border.