I have a container element that I am trying to figure out if I can shape it to have two 45 degree angles. Like this:
It is simply a rectangle now:
<
you can also use gradients
here combined with background-size
and calc()
:
only borders:
#home-img-text-container {
margin:1em;
display:inline-block;
background:
linear-gradient(0deg, rgba(0,0,0,0.9), rgba(0,0,0,0.9)) top left no-repeat ,
linear-gradient(0deg, rgba(0,0,0,0.9), rgba(0,0,0,0.9)) bottom left no-repeat ,
linear-gradient(90deg, rgba(0,0,0,0.9), rgba(0,0,0,0.9)) top left no-repeat,
linear-gradient(0deg, rgba(0,0,0,0.9), rgba(0,0,0,0.9)) center right no-repeat,
linear-gradient(-45deg, transparent 1.5em, rgba(0,0,0,0.8) 1.5em, rgba(0,0,0,0.9) calc(1.5em + 3px), transparent calc(1.5em + 3px)) bottom left no-repeat,
linear-gradient(-135deg, transparent 1.5em, rgba(0,0,0,0.8) 1.5em, rgba(0,0,0,0.9) calc(1.5em + 3px), transparent calc(1.5em + 3px)) top left no-repeat
;
background-size:
calc(100% - 2.25em) 3px ,
calc(100% - 2.25em) 3px ,
3px 100%,
3px calc(100% - 4.25em),
100% 50%,
100% 50%
;
padding: 30px 20px;
}
#home-img-text-description {
font-size: 2.5em;
line-height: 1.4em;
}
html {
min-height:100%;
background:linear-gradient(to bottom right, tomato, gold);
}
WRECKING
& DEMOLITION
DONE RIGHT.
only background: (closest to question)
#home-img-text-container {
margin: 1em;
display: inline-block;
background:
linear-gradient(-45deg, transparent 1.5em, rgba(0, 0, 0, 0.8) 1.5em) bottom left no-repeat,
linear-gradient(-135deg, transparent 1.5em, rgba(0, 0, 0, 0.8) 1.5em) top left no-repeat;
background-size: 100% 50%;
/* rgba(0,0,0,.8);*/
padding: 30px 20px;
}
#home-img-text-description {
color: #FFF;
font-size: 2.5em;
line-height: 1.4em;
}
html {
background:linear-gradient(to bottom right, tomato 30%, white 30%);
}
WRECKING
& DEMOLITION
DONE RIGHT.
border and background :
#home-img-text-container {
margin:1em;
display:inline-block;
background:
linear-gradient(0deg, rgba(0,0,0,0.9), rgba(0,0,0,0.9)) top left no-repeat ,
linear-gradient(0deg, rgba(0,0,0,0.9), rgba(0,0,0,0.9)) bottom left no-repeat ,
linear-gradient(90deg, rgba(0,0,0,0.9), rgba(0,0,0,0.9)) top left no-repeat,
linear-gradient(0deg, rgba(0,0,0,0.9), rgba(0,0,0,0.9)) center right no-repeat,
linear-gradient(-45deg, transparent 1.5em, rgba(0,0,0,0.8) 1.5em, rgba(0,0,0,0.9) calc(1.5em + 3px), transparent calc(1.5em + 3px)) bottom left no-repeat,
linear-gradient(-135deg, transparent 1.5em, rgba(0,0,0,0.8) 1.5em, rgba(0,0,0,0.9) calc(1.5em + 3px), transparent calc(1.5em + 3px)) top left no-repeat,
linear-gradient(-45deg, transparent 1.5em, rgba(0,0,0,0.8) 1.5em) bottom left no-repeat,
linear-gradient(-135deg, transparent 1.5em, rgba(0,0,0,0.8) 1.5em) top left no-repeat;
background-size:
calc(100% - 2.25em) 3px ,
calc(100% - 2.25em) 3px ,
3px 100%,
3px calc(100% - 4.25em),
100% 50%, 100% 50%,
100% 50%, 100% 50%
;
/* rgba(0,0,0,.8);*/
padding: 30px 20px;
}
#home-img-text-description {
color: #FFF;
font-size: 2.5em;
line-height: 1.4em;
}
html {
background:linear-gradient(to bottom right, tomato 25%, gold 25%);
}
WRECKING
& DEMOLITION
DONE RIGHT.
demo & codepen to play with