I have this CSS triangle:
http://codepen.io/orweinberger/pen/myEoVa
CODE:
*,
*:before,
*:after {
box-sizing: border-box;
}
.triangle {
position:absolute;
bottom:0;
right:0;
display: inline-block;
vertical-align: middle;
}
.triangle-0 {
width: 200px;
height: 200px;
border-bottom: solid 100px rgb(85,85,85);
border-right: solid 100px rgb(85,85,85);
border-left: solid 100px transparent;
border-top: solid 100px transparent;
}
.text {
color:#fff;
position:absolute;
bottom:0;
right:0;
}
Is it possible to add a shadow to one of the edges, similar to this?
http://codepen.io/orweinberger/pen/ByzbKX
box-shadow: h-offset v-offset blur spread color; box-shadows values: h-offset: It is required and used to set the position of the shadow horizontally. The positive value is used to set the shadow on right side of the box and a negative value is used to set the shadow on the left side of the box.
A light source positioned above an element will cast a shadow below the element. Placing a light source to the left of an element will cast a shadow to the right. Placing multiple light sources to the top, bottom, left and right of an element actually casts no shadow at all!
You can use another approach for the triangle to be able to apply a box-shadow to it :
body {
overflow: hidden;
}
div {
position: absolute;
bottom: 0;
right: 0;
height: 150px;
width: 213px;
background: lightgrey;
-webkit-transform-origin:100% 0;
-ms-transform-origin:100% 0;
transform-origin: 100% 0;
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
box-shadow: 0px -3px 5px 0px #656565;
}
<div></div>
More info here on triangles with transform rotate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With