gear icon using a single div in pure css - html

I'm trying to create this icon using pure css & a single div
so far I've only managed to add 2 points like this:
:root {
--gear_radius: 5rem;
--gear_color: black;
--gear_thickness: 1.5rem;
--gear_pin_length: 1.5rem;
--gear_pin_gap: 1.5rem;
}
.gear {
margin: 5rem;
height: var(--gear_radius);
width: var(--gear_radius);
border-radius: 50%;
border: var(--gear_color) var(--gear_thickness) solid;
box-sizing: border-box;
position: relative;
}
.gear:before {
position: absolute;
content: "";
display: block;
height: var(--gear_pin_length);
width: var(--gear_thickness);
left: 50%;
top: 50%;
transform: translate(-50%, -50%) rotate(45deg);
box-shadow: 0 calc(var(--gear_thickness) * 2) 0 0 black, 0 calc(var(--gear_thickness) * -2) 0 0 black;
}
.gear:after {
position: absolute;
content: "";
display: block;
height: var(--gear_pin_length);
width: var(--gear_thickness);
left: 50%;
top: 50%;
transform: translate(-50%, -50%) rotate(-45deg);
box-shadow: 0 calc(var(--gear_thickness) * 2) 0 0 black, 0 calc(var(--gear_thickness) * -2) 0 0 black;
}
<div class="gear"></div>
How do I add 2 more points at the top and bottom? I don't know what approach to take from here?

The original picture of a gear wheel has an angle to the sides of each tooth.
However, I notice that in your part-solution you aren't worried about that and have parallel edges.
Here's a snippet that puts in all 6 teeth with parallel edges.
It uses before and after pseudo elements which had stripes as background and are rotated. The main div also has a stripe for a background but additionally a radial gradient with white and black circles.
.cog {
width: 30vmin;
height: 30vmin;
position: relative;
background-image: radial-gradient(white 0 35%, black 35% 70%, transparent 70% 100%), linear-gradient(to right, black, black);
background-size: 70% 70%, 25% 100%;
}
.cog::before,
.cog::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: linear-gradient(to right, black, black);
background-size: 25% 100%;
z-index: -1;
}
.cog,
.cog::before,
.cog::after {
background-repeat: no-repeat;
background-position: center center;
transform-origin: center;
}
.cog::before {
transform: rotate(60deg);
}
.cog::after {
transform: rotate(120deg);
}
<div class="cog"></div>
Here's what it produces:
To get more sophisticated shape - such as the slope on the teeth, you could do more with gradients or just CSS clip-path (though by the time you've done this you probably might as well have created an SVG).

Well, of course SVG is better, but since your question is more of a challenge, here is my solution:
* {
margin: 0;
padding: 0;
}
.icon {
position: relative;
background: beige;
height: 160px;
width: 160px;
}
.wheel {
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
width: 32px;
height: 32px;
background: beige;
border-radius: 50%;
border: solid 24px brown;
}
.cog {
position: absolute;
width: 24px;
height: 120px;
border-radius: 6px;
background: brown;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
}
.cog:nth-child(2) {
transform: rotate(45deg);
}
.cog:nth-child(3) {
transform: rotate(90deg)
}
.cog:nth-child(4) {
transform: rotate(135deg)
}
<div class="icon">
<div class="cogs">
<div class="cog"></div>
<div class="cog"></div>
<div class="cog"></div>
<div class="cog"></div>
</div>
<div class="wheel"></div>
<div>

Related

How can I paint a sector only with border-radius?

As we know, in CSS, we can use:
width : 100px; height : 100px; border-radius : 100% 0 0 0;
To paint a sector with 90deg; and I want to use this way to paint a sector with any deg. But the front sector doesn't cover perfectly. It leaks a slice of red sector and I don't know how to handle it.
body {
background-color: #fbb;
}
.box {
width: 200px;
height: 200px;
position: relative;
background-color: #f00;
border-radius: 100% 0 0;
}
.box::after {
content: '';
display: block;
position: absolute;
width: 100%;
height: 100%;
background-color: #fbb;
border-radius: 100% 0 0;
-webkit-transform-origin: 100% 100%;
transform-origin: 100% 100%;
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
<div class="box"></div>
You can cheat a bit and shift the whole overlay with an additional transform.
body {
background-color: #fbb;
}
.box {
width: 200px;
height: 200px;
position: relative;
background-color: #f00;
border-radius: 100% 0 0;
}
.box::after {
content: '';
display: block;
position: absolute;
width: 100%;
height: 100%;
background-color: #fbb;
border-radius: 100% 0 0;
transform-origin: 100% 100%;
transform: rotate(45deg) translate(-1px, 0px); /* <---- here */
}
<div class="box"></div>
It also seems to work by shifting the transform origin slightly.
body {
background-color: #fbb;
}
.box {
width: 200px;
height: 200px;
position: relative;
background-color: #f00;
border-radius: 100% 0 0;
}
.box::after {
content: '';
display: block;
position: absolute;
width: 100%;
height: 100%;
background-color: #fbb;
border-radius: 100% 0 0;
transform-origin: 101% 100%; /* <---- here */
transform: rotate(45deg);
}
<div class="box"></div>
You could also use a sharp box shadow.
body {
background-color: #fbb;
}
.box {
width: 200px;
height: 200px;
position: relative;
background-color: #f00;
border-radius: 100% 0 0;
}
.box::after {
content: '';
display: block;
position: absolute;
width: 100%;
height: 100%;
background-color: #fbb;
border-radius: 100% 0 0;
transform-origin: 100% 100%;
transform: rotate(45deg);
box-shadow: 0 0 0 .5px #fbb; /* <---- here */
}
<div class="box"></div>
None of these are mathematically perfect, but they may suit your practical needs.

Add semi circle curve for a div at left and right using background color - CSS [duplicate]

This question already has answers here:
CSS Cut out circle from a rectangular shape
(3 answers)
Closed 1 year ago.
Can anyone help me with how to get the style like in the image attached below using background colour for a div? I tried adding using pseudo-classes before and after but doesn't seem to be coming through.
.card {
height: 190px;
background: #070B32;
width: 360px;
position: relative;
}
.card:before {
background: #070B32;
position: absolute;
content: "";
left: 0;
height: 50px;
border-radius: 50% 50% 0 0;
}
.card:after {
background: #070B32;
position: absolute;
content: "";
right: 0;
height: 50px;
border-radius: 50% 50% 0 0;
}
<div class="card">
</div>
Use width top values too to have semi-circles with a change in color
.card {
height: 190px;
background: #070B32;
width: 360px;
position: relative;
}
.card:before {
background: white;
position: absolute;
content: "";
left: 0;
top:35%;
width: 25px;
height: 50px;
border-radius: 0 150px 150px 0;
}
.card:after {
background: white;
position: absolute;
content: "";
right: 0;
top:35%;
width: 25px;
height: 50px;
border-radius: 150px 0 0 150px;
}
<div class="card">
</div>
Update:
div {
height: 150px;
margin: 5em 2em;
background: radial-gradient(circle at left center, transparent, transparent 30px, #070B32 30px, transparent), radial-gradient(circle at right center, transparent, transparent 30px, #070B32 30px, transparent);
border-radius: 8px;
position: relative;
width: 360px;
margin: auto;
}
body {
background-image: url(http://www.fillmurray.com/1000/1000);
background-size: cover;
}
<div>
</div>
you should use width: 50px, background-color: white;
and responsive vertical alignment:
top: 50%; transform: translateY(-50%);
.card {
height: 190px;
background: #070B32;
width: 360px;
position: relative;
}
.card:before {
background: #ffffff;
position: absolute;
content: "";
left: -25px;
top: 50%;
transform: translateY(-50%);
height: 50px;
width: 50px;
border-radius: 50%;
}
.card:after {
background: #ffffff;
position: absolute;
content: "";
right: -25px;
top: 50%;
transform: translateY(-50%);
height: 50px;
width: 50px;
border-radius: 50%;
}
<div class="card">
</div>
Or just use a background.
.card {
--circle-color: #fff;
--circle-size: 50px;
background: radial-gradient(farthest-side circle, var(--circle-color) 97%, transparent) calc(100% + (var(--circle-size) / 2)) 50% / var(--circle-size) var(--circle-size),
radial-gradient(farthest-side circle, var(--circle-color) 97%, transparent) calc(var(--circle-size) / -2) 50% / var(--circle-size) var(--circle-size),
#070B32;
background-repeat: no-repeat;
height: 190px;
width: 360px;
}
<div class="card">
</div>

Issue in set the cut-div on image

I've created cut div from both let and right side with css and I want to set that half div on the image. But due to border-color:white the cut part is not coming transparent. I've tried to give the border-color:transparent but it does not work, instead it removes the cut portion... What should be the problem to make it transparent?
Here is my code:
.goldenstrip::after {
content: '';
position: absolute;
top: 0;
left: 0;
border-bottom: 106px solid white;
border-right: 40px solid #c1b07a;
width: 0;
bottom: 0;
}
.goldenstrip::before {
content: '';
position: absolute;
top: 0;
right: 0;
border-top: 106px solid white;
border-left: 40px solid #c1b07a;
width: 0;
bottom: 0;
}
.goldenstrip {
text-align: center !important;
display: block;
text-transform: uppercase;
background: #C1B07A;
color: white;
font-size: 24px;
margin: 0 auto;
padding: 38px 0px;
position: relative;
font-family: "Roboto Medium";z-index: 1;
top: 52px;
width: 90%;
}
.seminar_image img {
width: 100%;
}
<span class="goldenstrip">Hello world</span>
<div class="seminar_image"><img src="https://stepupandlive.files.wordpress.com/2014/09/3d-animated-frog-image.jpg" alt="" class=""></div>
Please use this css instead of your after and before css.
goldenstrip::after {
content: '';
position: absolute;
top: 0;
left: -22px;
width: 45px;
bottom: 0;
transform: skew(23deg);
background: #c1b07a;
}
.goldenstrip::before {
content: '';
position: absolute;
top: 0;
right: -22px;
width: 50px;
bottom: 0;
background: #c1b07a;
transform: skew(23deg);
}
Use transform property for a slanted edge div.
.goldenstrip::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #c1b07a;
-webkit-transform-origin: 100% 0;
-ms-transform-origin: 100% 0;
transform-origin: 100% 0;
-webkit-transform: skew(20deg);
-ms-transform: skew(20deg);
transform: skew(20deg);
z-index: -1;
}
.goldenstrip::before {
content: '';
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
background: #c1b07a;
-webkit-transform-origin: 100% 0;
-ms-transform-origin: 100% 0;
transform-origin: 0 100%;
-webkit-transform: skew(20deg);
-ms-transform: skew(20deg);
transform: skew(20deg);
z-index: -1;
}
.goldenstrip {
text-align: center !important;
display: block;
text-transform: uppercase;
background: #C1B07A;
color: white;
font-size: 24px;
margin: 0 auto;
padding: 38px 0px;
position: relative;
font-family: "Roboto Medium";
z-index: 1;
top: 52px;
width: 90%;
}
.seminar_image img {
width: 100%;
}
<span class="goldenstrip">Hello world</span>
<div class="seminar_image"><img src="https://stepupandlive.files.wordpress.com/2014/09/3d-animated-frog-image.jpg" alt="" class=""></div>
Use linear-gradient and multiple background to create the shape and avoid any extra element:
.goldenstrip {
text-align: center !important;
display: block;
text-transform: uppercase;
color: white;
font-size: 24px;
margin: 0 auto;
padding: 38px 0px;
position: relative;
font-family: "Roboto Medium";
z-index: 1;
top: 52px;
width: 90%;
background:
linear-gradient(to top right, transparent 49%, #C1B07A 50%) left/ 30px 100% no-repeat,
linear-gradient(to bottom left, transparent 49%, #C1B07A 50%) right/ 30px 100% no-repeat,
linear-gradient(#C1B07A, #C1B07A) center/calc(100% - 60px) 100% no-repeat;
}
.seminar_image img {
width: 100%;
}
<span class="goldenstrip">Hello world</span>
<div class="seminar_image"><img src="https://stepupandlive.files.wordpress.com/2014/09/3d-animated-frog-image.jpg" alt="" class=""></div>

How do I create a cut-out hexagon shape?

How can I create a cut-out hexagon shape using CSS?
By cut-out hexagon shape I mean something like this:
I was able to create a hexagon with a background image, but I need it to be like in the image.
.hexagon {
position: relative;
width: 300px;
height: 173.21px;
margin: 86.60px 0;
background-image: url('https://placeimg.com/300/400/any');
background-size: auto 346.4102px;
background-position: center;
}
.hexTop,
.hexBottom {
position: absolute;
z-index: 1;
width: 212.13px;
height: 212.13px;
overflow: hidden;
-webkit-transform: scaleY(0.5774) rotate(-45deg);
-ms-transform: scaleY(0.5774) rotate(-45deg);
transform: scaleY(0.5774) rotate(-45deg);
background: inherit;
left: 43.93px;
}
/* Counter transform the background image on the caps */
.hexTop:after,
.hexBottom:after {
content: "";
position: absolute;
width: 300.0000px;
height: 173.20508075688775px;
-webkit-transform: rotate(45deg) scaleY(1.7321) translateY(-86.6025px);
-ms-transform: rotate(45deg) scaleY(1.7321) translateY(-86.6025px);
transform: rotate(45deg) scaleY(1.7321) translateY(-86.6025px);
-webkit-transform-origin: 0 0;
-ms-transform-origin: 0 0;
transform-origin: 0 0;
background: inherit;
}
.hexTop {
top: -106.0660px;
}
.hexTop:after {
background-position: center top;
}
.hexBottom {
bottom: -106.0660px;
}
.hexBottom:after {
background-position: center bottom;
}
.hexagon:after {
content: "";
position: absolute;
top: 0.0000px;
left: 0;
width: 300.0000px;
height: 173.2051px;
z-index: 2;
background: inherit;
}
<div class="hexagon">
<div class="hexTop"></div>
<div class="hexBottom"></div>
</div>
For this transparent cut-out hexagon, I would suggest using an inline SVG with the path element:
svg{
display: block;
width: 70%;
height: auto;
margin: 0 auto;
}
path{
transition: fill .5s;
fill: #E3DFD2;
}
path:hover{
fill: pink;
}
body{background:url('https://farm9.staticflickr.com/8760/17195790401_ceeeafcddb_o.jpg');background-position:center;background-size:cover;}
<svg viewbox="-10 -2 30 14">
<path d=" M-10 -2 H30 V14 H-10z M2.5 0.66 L0 5 2.5 9.33 7.5 9.33 10 5 7.5 0.66z" />
</svg>
Hexagon mask point calculations:
The hexagon coordiantes are pretty easy to calculate. For a regular hexagon in the above orientation:
width = height / sin(60deg)
sin(60deg) ~=0.866
If width is 10 (like in the above example) the coordinates are:
You can find these coordinate in the d attribute after the second M.
Why use SVG?
The main advantages of using SVG in this case are:
Maintainability (example: imagine you need to change the color of the mask. In SVG it is clear what you need to change and there is only one attribute to change.)
Shorter code
You can easily use an image or gradient to fill the mask
Maintain the boundaries of the shape and trigger mouse envents only over the fill respecting the mask (hover the transparent hexagon in the example).
Original example with the mask element:
body{background:url('https://farm9.staticflickr.com/8760/17195790401_ceeeafcddb_o.jpg');background-position:center;background-size:cover;}
svg{
display: block;
width: 70%;
height: auto;
margin: 0 auto;
}
<svg viewbox="-10 -2 30 14" >
<defs>
<mask id="mask" x="0" y="0" width="10" height="10">
<rect x="-10" y="-2" width="40" height="16" fill="#fff"/>
<polygon points="2.5 0.66 7.5 0.66 10 5 7.5 9.33 2.5 9.33 0 5" />
</mask>
</defs>
<rect x="-10" y="-5" width="30" height="20" mask="url(#mask)" fill="#E3DFD2"/>
</svg>
This type of shape can be achieved by filling the outer part of the hexagon using elements. Different transform:rotate(xdeg) should be applied to each element to achieve this effect.
Here is a snippet creating this effect.
Note: The below snippet is supposed to be responsive, so if it appears broken, see the one below it.
* {
margin: 0;
padding: 0;
}
body, html {
width: 100%;
height: 100%;
}
body {
display: flex;
align-items: center;
background: url('https://placeimg.com/800/600/any');
background-size: cover;
background-attachment: fixed;
}
.container {
width: 50%;
height: 50%;
position: relative;
margin: 0 auto;
overflow: hidden;
border: 10px solid #009688;
}
.cut:after {
position: absolute;
content: "";
width: 100%;
height: 100%;
background: #009688;
transform-origin: 0% 100%;
transform: rotate(-60deg);
top: 0;
}
.cut:before {
position: absolute;
content: "";
width: 100%;
height: 100%;
background: #009688;
transform-origin: 0% 0%;
transform: rotate(60deg);
top: 0;
}
.container:after {
position: absolute;
content: "";
width: 100%;
height: 100%;
background: #009688;
transform-origin: 100% 0%;
transform: rotate(-60deg);
top: 0;
}
.container:before {
position: absolute;
content: "";
width: 100%;
height: 100%;
background: #009688;
transform-origin: 100% 100%;
transform: rotate(60deg);
top: 0;
}
<div class="container">
<div class="cut"></div>
</div>
With fixed height and width (better viewed in full screen):
* {
margin: 0;
padding: 0;
}
body, html {
width: 100%;
height: 100%;
}
body {
display: flex;
align-items: center;
background: url('https://placeimg.com/800/600/any');
background-size: cover;
background-attachment: fixed;
}
.container {
width: 500px;
height: 300px;
position: relative;
margin: 0 auto;
overflow: hidden;
border: 10px solid #009688;
}
.cut:after {
position: absolute;
content: "";
width: 100%;
height: 100%;
background: #009688;
transform-origin: 0% 100%;
transform: rotate(-60deg);
top: 0;
}
.cut:before {
position: absolute;
content: "";
width: 100%;
height: 100%;
background: #009688;
transform-origin: 0% 0%;
transform: rotate(60deg);
top: 0;
}
.container:after {
position: absolute;
content: "";
width: 100%;
height: 100%;
background: #009688;
transform-origin: 100% 0%;
transform: rotate(-60deg);
top: 0;
}
.container:before {
position: absolute;
content: "";
width: 100%;
height: 100%;
background: #009688;
transform-origin: 100% 100%;
transform: rotate(60deg);
top: 0;
}
<div class="container">
<div class="cut"></div>
</div>
This is how the cut-out hexagon works:
SVG is the best tool for such things and the biggest contributing factor towards that is that it is easier to create and maintain such shapes as SVG.
But these can be done with CSS transform in another way with simpler transforms also. All we need to do is make use of skew transform and set skew angle based on the shape that is required.
For hexagons, the angle between each side is 120 degrees and so the elements have to be skewed by +/- 30 degrees. For pentagons, the angle between each side is 108 degrees and so skew angles on the bottom half would be +/- 18 degrees but the top half would have +/- 36 degrees. For diamond, the angle between each side is 90 degrees and so the skew angles would be +/-45 degrees.
A few positive points of this approach are: (not that SVG doesn't have these)
The shapes created using this approach are responsive (try hovering on the shapes in demo)
Transforms are pretty well supported given that IE8 is on the way out (Microsoft themselves are stopping support for IE8 from Jan '16). This is not bad when compared with SVG because SVG has the same browser support.
There are quite a few drawbacks of using CSS though:
Extra elements are required in-order to produce the shape.
These would work only in IE9+ (that is, browsers that support transforms). The drawback is not in comparison with SVG but in general.
Fill for the area other than the cut-out cannot be a gradient or an image. It can only be solid color.
Hover effects can be added (as shown in the demo) but it will triggered when the mouse is over the cut-out area also because it is still a part of the container even though it is transparent.
.shape {
position: relative;
height: 100px;
border: 20px solid palevioletred;
overflow: hidden;
}
.shape.hexagon {
width: calc(100px + (100px * 0.577)); /* width = height + (height * tan 30) for hexagon */
}
.shape.pentagon {
width: calc(100px * 1.051); /* width = height * 1.618/1.539 for pentagon (Source: Wiki - https://en.wikipedia.org/wiki/Pentagon */
}
.shape.diamond {
width: 100px; /* height = width for diamond */
}
.hexagon .inner, .pentagon .inner, .diamond .inner {
position: absolute;
height: 100%;
width: 50%;
top: 0px;
left: 85%;
}
.diamond .inner {
left: 100%;
}
.shape:after, .shape:before {
position: absolute;
content: '';
height: 50%;
width: 50%;
left: -35%;
background: palevioletred;
}
.shape.diamond:before, .shape.diamond:after {
left: -50%;
}
.hexagon .inner:after, .hexagon .inner:before, .pentagon .inner:after,
.pentagon .inner:before, .diamond .inner:after, .diamond .inner:before {
position: absolute;
content: '';
height: 50%;
width: 100%;
left: 0px;
background: palevioletred;
}
.shape.hexagon:before, .hexagon .inner:after {
transform: skew(-30deg);
}
.shape.hexagon:after, .hexagon .inner:before {
transform: skew(30deg);
}
.shape.pentagon:before {
transform: skew(-36deg);
}
.shape.pentagon:after{
transform: skew(18deg);
}
.shape.diamond:before, .diamond .inner:after {
transform: skew(-45deg);
}
.shape.diamond:after, .diamond .inner:before {
transform: skew(45deg);
}
.pentagon .inner:before {
transform: skew(36deg);
}
.pentagon .inner:after {
transform: skew(-18deg);
}
.shape:before, .inner:before {
top: 0px;
transform-origin: right bottom;
}
.shape:after, .inner:after {
bottom: 0px;
transform-origin: right top;
}
/* just for demonstrating responsiveness */
.shape {
float: left;
margin: 10px;
transition: all 1s linear;
}
.shape:hover{ height: 150px; }
.shape.hexagon:hover { width: calc(150px + (150px * 0.577)); }
.shape.pentagon:hover { width: calc(150px * 1.051); }
.shape.diamond:hover { width: 150px; }
body {
background: url(http://lorempixel.com/500/500/nature/6) fixed;
background-size: cover;
}
<div class='shape hexagon'>
<div class='inner'></div>
</div>
<div class='shape pentagon'>
<div class='inner'></div>
</div>
<div class='shape diamond'>
<div class='inner'></div>
</div>
The SVG approach is obviously good! But I tried getting it done via CSS! Somehow I managed to get it till here...
* {
box-sizing: border-box;
margin: 0;
padding: 0
}
.relative {
position: relative;
}
.absolute {
position: absolute;
}
body {
background: url('http://lorempicsum.com/up/627/300/4') no-repeat top left;
background-size: cover;
padding-top: 10%;
}
.parent {
margin: 0 auto;
display: table;
width: 400px;
height: 230px;
text-align: center;
table-layout: fixed;
}
.orange {
display: table-cell;
vertical-align: middle;
background: transparent;
width: 100%;
height: 230px;
margin: 0 auto;
overflow: hidden;
position: relative;
border-left: 137px solid orange;
border-right: 137px solid orange;
}
.one,
.two {
position: relative;
width: 126px;
height: auto;
display: block;
border-left: 28px solid orange;
border-right: 28px solid orange;
margin: 0 auto;
}
.one {
border-top: 60px solid transparent;
border-bottom: 60px solid orange;
}
.two {
border-top: 60px solid orange;
border-bottom: 60px solid transparent;
}
<div class="parent">
<div class="orange">
<div class="two"></div>
<div class="one"></div>
</div>
</div>
This answer illustrates the costs of using only one element
SVG is the tool for this. Any CSS alternative will probably be very hacky and quirky, so I say the best is to use SVG.
Using CSS
Properties used are:
box-shadows (for color around transparent region)
perspective transforms, rotation
overflow hidden
pseudoelement
body {
background:url('http://i.imgur.com/TYP4Xka.jpg');
}
#box {
height: 400px;
width: 400px;
position: relative;
box-shadow: inset 70px 0 0 #444, inset -70px 0 0 #444, inset 0 0 0 50px #444;
overflow: hidden;
}
#box:before {
content: "";
position: absolute;
height: 150px;
width: 259.8px; /* w = h * sqrt(3) bcoz w = 2*h*cos(30deg) */
top: 125px; /* (parentHeight - pseudoHeight)/2 */
left: 70.1px; /* (parentWidth - pseudoWidth)/2 */
-webkit-transform: rotate(60deg);
-moz-transform: rotate(60deg);
transform: rotate(60deg);
box-shadow: 70px 0 0 #444, -70px 0 0 #444;
}
#box:after {
content: "";
position: absolute;
height: 150px;
width: 259.8px;
top: 125px;
left: 70.1px;
-webkit-transform: rotate(120deg);
-moz-transform: rotate(120deg);
transform: rotate(120deg);
box-shadow: 70px 0 0 #444, -70px 0 0 #444;
}
<div id="box"></div>
NOTE
You can also kind off morph the shape around in an animation, but be warned. Do not use a lot of box-shadows for anything, especially for animation. Box- shadow has a very high CPU usage.

Add pointer to the bottom of a div as a continuation of its background image

I'm looking for a way to stack divs, with a pointer leading into the next div that is a continuation of the previous div's background image.
I've looked around and I've seen some options, but in all of them the bottom div has to be a solid color.
For example: http://jsfiddle.net/nhqKb/
#container{
height: 300px;
background: url('http://farm8.staticflickr.com/7358/9532233404_58763bd668_b.jpg') no-repeat;
position: relative;
}
#one {
position: absolute;
width: 100px;
left: 0;
bottom: 0;
border-bottom: 20px solid green;
border-right: 20px solid transparent;
}
#two {
position: absolute;
left: 120px;
bottom: 0;
right: 0;
border-bottom: 20px solid green;
border-left: 20px solid transparent;
}
<div id="container">
<div id="one"></div>
<div id="two"></div>
</div>
Is there any way to implement this using divs with background images instead of solid colors?
You can use skewX and pseudo elements to make this.
#container {
background: url('https://images.unsplash.com/photo-1440635592348-167b1b30296f?ixlib=rb-0.3.5&q=80&fm=jpg&w=1080&fit=max&s=a029f986631f264fdbc8c0272cab9c40') no-repeat;
height: 300px;
position: relative;
overflow: hidden;
}
#one {
background-color: rgba(0, 0, 0, 0.3);
bottom: 0;
left: 0;
padding-bottom: 15px;
position: absolute;
width: 100%;
}
#one:before,
#one:after {
background-color: inherit;
bottom: 100%;
content: '';
padding-bottom: inherit;
position: absolute;
width: 50%;
}
#one:before {
right: 50%;
-ms-transform-origin: 100% 100%;
-webkit-transform-origin: 100% 100%;
transform-origin: 100% 100%;
-ms-transform: skewX(45deg);
-webkit-transform: skewX(45deg);
transform: skewX(45deg);
}
#one:after {
left: 50%;
-ms-transform-origin: 0 100%;
-webkit-transform-origin: 0 100%;
transform-origin: 0 100%;
-ms-transform: skewX(-45deg);
-webkit-transform: skewX(-45deg);
transform: skewX(-45deg);
}
HTML code:
<div id="container">
<div id="one"></div>
</div>