I need to add borders to this "shape". It's kinda difficult because the shape is made with the after and before pseudo-elements. I can't find the right way.
What I need to achieve:
The code I have so far:
https://jsfiddle.net/jimmyadaro/xfcjfz3d/
#octagon {
width: 300px;
height: 200px;
background: red;
position: relative;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
display: block;
}
#octagon:before,
#octagon:after {
content: "";
position: absolute;
left: 0;
right: 0;
}
#octagon:before {
top: 0;
border-bottom: 30px solid red;
border-left: 30px solid #fff;
border-right: 30px solid #fff;
}
#octagon:after {
bottom: 0;
border-top: 30px solid red;
border-left: 30px solid #fff;
border-right: 30px solid #fff;
}
<div id="octagon"></div>
I tried with shadows and outlines without success.
Thanks for reading.
Note: I'll use a solid background color, if that matters.
Here's my solution. No solid background color is required. This may or may not suit your actual use case.
JSFiddle
#octagon {
display: flex;
justify-content: center;
align-items: center;
width: 300px;
height: 200px;
overflow: hidden;
position: relative;
}
#octagon:before,
#octagon:after {
content: "";
display: block;
width: 300px;
padding-top: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(45deg);
z-index: -1;
}
#octagon:before {
background: red;
}
#octagon:after {
background:
linear-gradient(
45deg,
#0e0 calc(50% - 150px + 10px), transparent 0,
transparent calc(50% + 150px - 10px), #0e0 0%),
linear-gradient(
-45deg,
#0e0 calc(50% - 100px + 10px), transparent 0,
transparent calc(50% + 100px - 10px), #0e0 0);
box-shadow: 0 0 0 10px #0e0 inset;
}
<div id="octagon">Hello World!</div>
Well, this is the only way I could think of approaching it in pure CSS:
JSfiddle here: https://jsfiddle.net/xfcjfz3d/7/
body {
background:#fff;
}
#octagon {
position:relative;
width: 300px;
height: 200px;
background: green;
position: relative;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
display: block;
}
#octagon:before,
#octagon:after {
content: "";
position: absolute;
left: 0;
right: 0;
}
#octagon:before {
top: 0;
border-bottom: 30px solid green;
border-left: 30px solid #fff;
border-right: 30px solid #fff;
}
#octagon:after {
bottom: 0;
border-top: 30px solid green;
border-left: 30px solid #fff;
border-right: 30px solid #fff;
}
.tall {
position:absolute;
background:red;
width:230px;
height:190px;
left:35px;
top:5px;
z-index:1;
}
.wide {
position:absolute;
background:red;
width:290px;
height:130px;
left:5px;
top:35px;
z-index:1;
}
.corner {
position:absolute;
background:red;
width:45px;
height:43px;
z-index:1;
transform: rotate(45deg);
}
.topleft {
left:14px;
top:14px;
}
.topright {
//background:black;
left:241px;
top:13px;
}
.bottomleft {
background:red;
left:13px;
top:143px;
}
.bottomright {
background:red;
left:241px;
top:143px;
}
<div id="octagon">
<div class="tall"></div>
<div class="wide"></div>
<div class="corner topleft"></div>
<div class="corner topright"></div>
<div class="corner bottomleft"></div>
<div class="corner bottomright"></div>
</div>
Related
I am trying to create a triangle shape with the pseudo elements. like the one in the image below.
But this is what i get.
Here is what i have tried this far.
.container .form--container:before {
content: "";
position: absolute;
top: 0px;
left: 130px;
width: 28px;
height: 28px;
transform: translate(-1rem, -100%);
border-left: 1.5rem solid #979797;
border-right: 1.5rem solid #979797;
border-bottom: 1.5rem solid white;
}
The issue is with the use of border. you can check this link How do CSS triangles work? and you will understand how border works and why you get this output.
An alternative solution is to use rotation and border like this :
.box {
border: 1px solid;
margin: 50px;
height: 50px;
position:relative;
background: #f2f2f5;
}
.box:before {
content: "";
position: absolute;
width: 20px;
height: 20px;
border-top: 1px solid;
border-left: 1px solid;
top: -11px;
left: 13px;
background: #f2f2f5;
transform: rotate(45deg);
}
<div class="box">
</div>
And in case you want your box with the arrow to be transparent, here is another trick to achieve it (as the above solution consider solid color as background):
body {
margin:0;
background-image:linear-gradient(to right,yellow,pink);
}
.box {
border: 1px solid;
border-top:transparent; /*make border-top transparent*/
margin: 50px;
height: 50px;
position:relative;
/* Use gradient to mimic the border top with a transparent gap */
background:linear-gradient(to right,black 10px,transparent 10px,transparent 39px,black 39px) top/100% 1px no-repeat;
}
.box:before {
content: "";
position: absolute;
width: 20px;
height: 20px;
border-top: 1px solid ;
border-left: 1px solid;
top: -11px;
left: 14px;
transform: rotate(45deg);
}
<div class="box">
</div>
Here is another version with dashed border:
body {
margin:0;
background-image:linear-gradient(to right,yellow,pink);
}
.box {
border: 1px dashed;
border-top:transparent; /*make border-top transparent*/
margin: 50px;
height: 50px;
position:relative;
background:
repeating-linear-gradient(to right,black 0,black 3px,transparent 3px,transparent 6px) top left/10px 1px,
repeating-linear-gradient(to right,black 0,black 3px,transparent 3px,transparent 6px) top right/calc(100% - 40px) 1px;
background-repeat:no-repeat;
}
.box:before {
content: "";
position: absolute;
width: 20px;
height: 20px;
border-top: 1px dashed;
border-left: 1px dashed;
top: -11px;
left: 13px;
transform: rotate(45deg);
}
<div class="box">
</div>
I'm trying to achieve the shape as shown in this image:
To have 2 rectangle divs with cut corners , and 1 div positioned behind another div.
But the corners seems incorrect and I can't find the way to show the borders of the shapes.
.wrapper {
display: flex;
justify-content: center;
}
.connect {
width: 254px;
height: 50px;
background: red;
background: #FF2D5069;
border-top: 2px solid #FF2175;
position: absolute;
bottom: 0;
z-index: 5;
}
.connect::before {
content: '';
position: absolute;
bottom: 0;
right: -2px;
border-top: 52px solid white;
border-left: 42px solid transparent;
}
.connect::after {
content: '';
position: absolute;
bottom: 0;
left: -2px;
border-top: 52px solid white;
border-right: 42px solid transparent;
}
.connect-behind {
width: 300px;
height: 44px;
background: red;
background: #FF2D5069;
border-top: 2px solid #FF2175;
position: absolute;
bottom: 0;
}
.connect-behind::before {
content: '';
position: absolute;
bottom: 0;
right: -2px;
border-top: 46px solid white;
border-left: 26px solid transparent;
}
.connect-behind::after {
content: '';
position: absolute;
bottom: 0;
left: -2px;
border-top: 46px solid white;
border-right: 26px solid transparent;
}
<div class="wrapper">
<div class="connect"></div>
<div class="connect-behind"></div>
</div>
I took reference from other threads to use behind and after for the solution but it doesn't seem working correct for my problem. Please help, thanks.
You could use perspective and transform:
possible example (for infos : with grid instead absolute) :
.wrapper {
display: grid;
justify-content: center;
align-items: end;
height: 300px;
perspective: 50px;
}
.connect,
.connect-behind {
transform: rotatex(50deg);
background: red;
margin: 0 auto;
background: #FF2D5069;
border-top: 2px solid #FF2175;
grid-row: 1;
grid-column: 1;
transform-origin: bottom center;
}
.connect-behind {
width: 300px;
height: 44px;
}
.connect {
width: 254px;
height: 50px;
;
}
<div class="wrapper">
<div class="connect"></div>
<div class="connect-behind"></div>
</div>
to draw a border around the shape, drop-shadow could be usefull
.wrapper {
display: grid;
justify-content: center;
align-items: end;
height: 300px;
perspective: 50px;
filter:
drop-shadow( 1px 0px 0 )
drop-shadow(-1px 0px 0 )
drop-shadow( 0px 1px 0 )
drop-shadow( 0px -1px 0 );
}
.connect,
.connect-behind {
transform: rotatex(50deg);
background: red;
margin: 0 auto;
background:white;
grid-row: 1;
grid-column: 1;
transform-origin: bottom center;
background:#ffa500;
}
.connect-behind {
width: 254px;
height: 50px;
border-left:solid 2px;
border-right:solid 2px;
}
.connect {
background:#ed1c24;
width: 300px;
height: 44px;
;
}
<div class="wrapper">
<div class="connect"></div>
<div class="connect-behind"></div>
</div>
You can use clip-path for things like this. Works well in a ( I think ) most browsers. Some, like ie11 and older browsers won't render it correctly, though, so you may need a fallback for those cases.
body {
overflow: hidden;
}
.wrapper {
display: flex;
justify-content: center;
}
.connect {
width: 254px;
height: 80px;
background: red;
background: #FF2D5069;
border-top: 2px solid black;
position: absolute;
bottom: 0;
z-index: 5;
clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
}
.connect-border-left {
height: 80px;
width: 2px;
background: black;
left: calc(50% - 131px);
position: absolute;
bottom: -12px;
transform: rotate(34deg) translateX(-50%);
display: inline-block;
}
.connect-border-right {
height: 80px;
width: 2px;
background: black;
right: calc(50% - 131px);
position: absolute;
bottom: -12px;
transform: rotate(-34deg) translateX(-50%);
display: inline-block;
}
.connect-behind {
width: 300px;
height: 60px;
background: red;
background: #FF2D5069;
border-top: 2px solid black;
position: absolute;
bottom: 0;
clip-path: polygon(14% 0%, 86% 0%, 100% 100%, 0% 100%);
}
.connect-behind-border-right {
height: 100px;
width: 2px;
background: black;
right: calc(50% - 103px);
position: absolute;
bottom: -11px;
transform: rotate(-32deg) translateX(-50%);
display: inline-block;
}
.connect-behind-border-left {
height: 100px;
width: 2px;
background: black;
left: calc(50% - 103px);
position: absolute;
bottom: -11px;
transform: rotate(32deg) translateX(-50%);
display: inline-block;
}
<div class="wrapper">
<div class="connect"></div>
<div class="connect-border-left"></div>
<div class="connect-border-right"></div>
<div class="connect-behind"></div>
<div class="connect-behind-border-left"></div>
<div class="connect-behind-border-right"></div>
</div>
an idea with skew transformation, clip-path and multiple background:
.box {
--b:3px; /* border width */
--t:20px; /* top part width */
--s:30px; /* side part width */
margin:10px;
display:inline-block;
width:250px;
height:150px;
position:relative;
}
.box::before,
.box::after {
content:"";
position:absolute;
top:0;
bottom:0;
left:0;
width:50%;
border-style:solid;
border-width:var(--b) 0 0 var(--b);
background:
linear-gradient(black 0 0) 0 var(--t)/100% var(--b),
linear-gradient(black 0 0) var(--s) 0/var(--b) 100%,
linear-gradient(red 0 0) left/var(--s) 100%,
orange;
background-repeat:no-repeat;
transform-origin:bottom right;
transform:skew(-20deg);
clip-path:polygon(0 calc(var(--t) + var(--b)), calc(var(--s) + var(--b)) calc(var(--t) + var(--b)),calc(var(--s) + var(--b)) 0,60% 0,100% 100%,0 100%);
}
.box::after {
transform:scale(-1,1) skew(-20deg);
}
<div class="box"></div>
<div class="box" style="--b:2px;--t:30px;--s:15px;"></div>
i am making block with arrow and border looks like
And i have tried this.
* {
box-sizing: border-box;
}
.block-arr {
background: purple;
margin: 20px;
margin-right: 100px;
position: relative;
}
.block-arr .inner {
min-height: 100px;
display: flex;
padding: 20px;
align-items: center;
position: relative;
}
.block-arr .inner:after {
border-top: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 50px solid purple;
content: '';
position: absolute;
left: 100%;
top: 0;
}
.block-arr:after {
border-top: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 50px solid purple;
content: '';
position: absolute;
left: 100%;
top: 0;
}
<div class="block-arr">
<div class="inner">
<strong>Main Heading</strong>
<span>Sub Heading</span>
</div>
</div>
How can i make block like image? And can we make this arrow height responsive?
I would consider a mix of skew transformation, inset box-shadow and some linear-gradient:
* {
box-sizing: border-box;
}
.block-arr {
padding: 50px;
margin: 20px;
margin-right: 100px;
position: relative;
background: linear-gradient(#fff, #fff)2px 0/2px 100% no-repeat, purple;
border-left: 2px solid purple;
z-index: 0;
}
.block-arr:before {
content: "";
position: absolute;
top: 0;
bottom: 50%;
left: 0;
right: 0;
background: purple;
border: 5px solid purple;
border-bottom: none;
border-left: none;
box-shadow: -2px 2px 0px #fff inset;
transform: skew(25deg);
transform-origin: top left;
z-index: -1;
}
.block-arr:after {
content: "";
position: absolute;
top: 50%;
bottom: 0;
left: 0;
right: 0;
background: purple;
border: 5px solid purple;
border-top: none;
border-left: none;
box-shadow: -2px -2px 0px #fff inset;
transform: skew(-25deg);
transform-origin: bottom left;
z-index: -1;
}
<div class="block-arr">
<strong>Main Heading</strong>
<span>Sub Heading</span>
</div>
<div class="block-arr">
<strong>Main Heading</strong><br/>
<span>Sub Heading</span>
</div>
<div class="block-arr">
</div>
And here is a more compressed version with some CSS variable to easily handle color. You can also do the same to handle others variables:
* {
box-sizing: border-box;
}
.block-arr {
--c1:purple;
--c2:#fff;
padding: 50px;
margin: 20px;
margin-right: 100px;
position: relative;
background: linear-gradient(var(--c2), var(--c2))2px 0/2px 100% no-repeat, var(--c1);
border-left: 2px solid var(--c1);
z-index: 0;
}
.block-arr:before,
.block-arr:after {
left: 0;
right: 0;
content: "";
position: absolute;
background: var(--c1);
border: 5px solid var(--c1);
border-left: none;
z-index: -1;
}
.block-arr:before {
top: 0;
bottom: 50%;
border-bottom: none;
box-shadow: -2px 2px 0px var(--c2) inset;
transform: skew(25deg);
transform-origin: top left;
}
.block-arr:after {
top: 50%;
bottom: 0;
border-top: none;
box-shadow: -2px -2px 0px var(--c2) inset;
transform: skew(-25deg);
transform-origin: bottom left;
}
<div class="block-arr">
</div>
<div class="block-arr" style="--c1:red;--c2:yellow">
<strong>Main Heading</strong>
<span>Sub Heading</span>
<p>And yes it is reponsive and grow when height grow</p>
</div>
BONUS
Another fancy and more complex way with only linear-gradient:
* {
box-sizing: border-box;
}
.block-arr {
--c1:purple;
--c2:#fff;
padding: 50px;
margin: 20px;
margin-right: 100px;
position: relative;
border:1px solid;
background:
linear-gradient(to top left,transparent calc(50% + 4px),var(--c2) calc(50% + 4px),var(--c2) calc(50% + 6px),transparent 0) 100% 100%/50px 50% no-repeat,
linear-gradient(to bottom left,transparent calc(50% + 4px),var(--c2) calc(50% + 4px),var(--c2) calc(50% + 6px),transparent 0) 100% 0/50px 50% no-repeat,
linear-gradient(var(--c2),var(--c2)) 4px calc(100% - 4px)/calc(100% - 58px) 2px no-repeat,
linear-gradient(var(--c2),var(--c2)) 4px 4px/calc(100% - 58px) 2px no-repeat,
linear-gradient(var(--c2),var(--c2)) 4px 4px/2px calc(100% - 8px) no-repeat,
linear-gradient(to top left ,transparent 50%,var(--c1) 50%) 100% 100%/50px 50% no-repeat,
linear-gradient(to bottom left,transparent 50%,var(--c1) 50%) 100% 0/50px 50% no-repeat,
linear-gradient(var(--c1),var(--c1)) 0 0/calc(100% - 50px) 100% no-repeat;
}
<div class="block-arr">
</div>
Using :after and :before pseudo elements, i have made this design.
Hope it fulfills your requirement.
Thanks
CSS and HTML:
* {
box-sizing: border-box;
}
p { margin:0; }
.block-arr {
background: purple;
margin: 20px;
margin-right: 100px;
position: relative;
}
.block-arr .inner {
min-height: 100px;
/*display: flex;*/
padding: 20px;
align-items: center;
position: relative;
}
.block-arr .inner:after {
border-top: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 50px solid purple;
content: '';
position: absolute;
left: 100%;
top: 0;
}
.block-arr:after {
border-top: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 50px solid purple;
content: '';
position: absolute;
left: 100%;
top: 0;
}
.bordered { position:relative; border:1px solid #fff; border-right:none; display: flex; align-items: center; padding:20px; }
.bordered:before, .bordered:after {
content: "";
position: absolute;
height: 72%;
width: 1px;
background: #fff;
top: 0;
right: 0;
z-index: 4;
}
.bordered:before {
transform: rotate(45deg);
top: auto;
right: -3.3%;
bottom: -11%;
}
.bordered:after {
transform: rotate(-45deg);
top: -12%;
right: -3.3%;
}
<div class="block-arr">
<div class="inner"><div class="bordered">
<p><strong>Main Heading</strong>
<span>Sub Heading</span></p>
</div></div>
</div>
I'm trying to draw a line using CSS and show text/image in the middle of the line.
.featured-images {
color: #666666;
border: 2px solid #333333;
}
<p class="featured-images">Featured</p>
This is what I want to do:
and
Wrap the text inside a span and use a :pseudo-element for the line.
Position the line(:pseudo-element) behind the span using z-index: -1, so that you could move around the text without having to worry about the line.
.featured-images {
position: relative;
color: #666666;
border: 2px solid #333333;
padding: 0 10px 0 30px;
}
.featured-images span {
color: #666666;
background: white;
padding: 0 10px;
}
.featured-images:after {
content: '';
position: absolute;
width: 100%;
height: 2px;
background: #666666;
left: 0;
top: 50%;
transform: translateY(-50%);
z-index: -1;
}
<p class="featured-images"><span>Featured</span></p>
Replicating the following:
You could use repeating-linear-gradient to do this.
body {
background: #E7EAE3;
}
.featured-images {
position: relative;
color: #666666;
padding: 0 10px 0 30px;
overflow: hidden;
}
.featured-images span {
color: #517575;
background: white;
padding: 0 10px;
}
.featured-images:after {
content: '';
position: absolute;
width: 120%;
height: 100%;
background: -webkit-repeating-linear-gradient(180deg, #463A3A 10px, #F2F2F2 10px, #F2F2F2 11px, #463A3A 11px, #463A3A 20px) repeat-x;
background: -moz-repeating-linear-gradient(180deg, #463A3A 10px, #F2F2F2 10px, #F2F2F2 11px, #463A3A 11px, #463A3A 20px) repeat-x;
background-size: 10px 31px;
margin-left: -30px;
transform: skew(-45deg);
left: 0;
z-index: -1;
}
<p class="featured-images"><span>Featured</span>
</p>
Using image instead of text.
.featured-images {
position: relative;
color: #666666;
border: 2px solid #333333;
padding: 0 10px 0 30px;
}
.featured-images span {
display: block;
width: 80px;
height: 13px;
background: url(http://lorempixel.com/80/13) no-repeat white 10px 0;
padding: 0 10px;
}
.featured-images:after {
content: '';
position: absolute;
width: 100%;
height: 2px;
background: #666666;
left: 0;
top: 50%;
transform: translateY(-50%);
z-index: -1;
}
<p class="featured-images"><span></span></p>
Something like this? JSFiddle
CSS:
.featured-images {
color: #666666;
}
p span {
margin:0;padding: 0 10px;
background: #FFFFFF;
display: inline-block;
}
p {
padding-left: 20px;
position: relative;
z-index: 2;
}
p:after {
content: "";
position: absolute;
top: 50%;
left: 0;
right: 0;
border-top: solid 1px #666666;
z-index: -1;
}
Demo 1
:root{padding: 40px}
p{
position: relative;
margin:40px auto;padding:0 10px;
background:white;
display:inline-block;
}
p:before,p:after{
content:"";
position:absolute;
z-index:-1;
right:0
}
p:before{
top:-4px;
left: -24px;
height: 24px;
width: 480px;
border:solid 1px #666666
}
p:after{
top: 50%;
width: 466px;
left: -16px;
border-top: solid 1px #666666
}
<p class="featured-images">Featured</p>
Use Pseudo element
:root{padding: 40px}
p{
position: relative;
margin:40px auto;padding:0 10px;
background:white;
display:inline-block;
}
p:before,p:after{
content:"";
position:absolute;
z-index:-1;
left:-14px;
right:0;
width: 480px
}
p:before{
top:-4px;
height: 24px;
border:solid 1px #666666
}
p:after{
top:50%;
border-top:solid 1px #666666
}
<p class="featured-images">Featured</p>
Demo 2
p{
position: relative;
margin:0;padding:0 10px;
background:white;
display:inline-block;
}
p:after{
content:"";
position:absolute;
top:50%;
left:-14px;
right:0;
width: 100vw;
border-top:solid 1px #666666;
z-index:-1;
}
<p class="featured-images">Featured</p>
Update
:root{padding: 40px}
p{
position: relative;
margin:40px auto;padding:0 10px;
background:white;
display:inline-block;
}
p:before,p:after{
content:"";
position:absolute;
z-index:-1;
right:0
}
p:before{
top:-4px;
left: -24px;
height: 24px;
width: 480px;
border:solid 1px #666666;
background-color: gray;
background-image: repeating-linear-gradient(-45deg, transparent, transparent 2px, rgba(255,255,255,.5) 2px, rgba(255,255,255,.5) 6px)
}
}
p:after{
top: 50%;
width: 466px;
left: -16px;
border-top: solid 1px #666666
}
<p class="featured-images">Featured</p>
Result http://jsfiddle.net/p8jdzqvL/embedded/result/
<div style="height: 2px; background-color: black; text-align: center">
<span style="background-color: white; position: relative; top: -0.5em;">
Stay Connected
</span>
</div>
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
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
It can be done by combining CSS transform and box-shadow. However I think skewX transform notation is more capable in this case.
Example Here - (vendor prefixes omitted due to brevity).
.triangle {
position:absolute;
bottom:0; right:0;
width: 200px;
height: 200px;
overflow: hidden;
}
.triangle::before {
content: "";
display: block;
width: 100%;
height: 100%;
background-color: rgb(85,85,85);
box-shadow: 0 0 7px rgba(0,0,0,.8);
transform: skewX(-45deg);
transform-origin: 0 100%;
}
.text {
color:#fff;
position: absolute;
bottom: 0; right: 0;
}
<div class="triangle"></div>
<div class="text">
Lorem ipsum...
</div>
if you just want out your shadow in bottom right corner
there have a solution,
*{margin:0px; padding:0px;}
.corner{
width:150px;
height:150px;
overflow: hidden;
position: absolute;
right:0px; bottom:0px;
}
.corner:before{
background:rgb(85,85,85);
width:220px;
height:220px;
transform: rotate(45deg);
margin: 48px;
box-shadow: 0px 0px 10px #111;
bottom: 0px;
right: 0px;
content:'';
display: block;
}
.text{position: absolute;
z-index: 2;
right: 10px;
bottom: 10px;
color: #fff;}
<div class="corner">
<div class="text">
Tesdt
</div>
</div>