<div class='my-example'>
<div class='content'>
<div class='text'>Text</div>
<!-- Don't use DIVs as buttons. This is just a design concept. -->
<div class='button'>Button</div>
</div>
<div class='content2'>Lorem ipsum, dolor sit amet consectetur adipisicing.</div>
</div>
@import url('https://fonts.googleapis.com/css2?family=Merriweather+Sans&display=swap');
@color1: #fa5;
@color2: #3a5;
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-family: 'Merriweather Sans', sans-serif;
font-size: ~'calc(14px + ((100vw - 400px) / 80))';
@media screen and (max-width: 400px) {
font-size: 14px;
}
@media screen and (min-width: 1200px) {
font-size: 24px;
}
line-height: 1.50;
}
.my-example {
overflow: hidden;
height: 20rem;
margin: 2rem auto;
> .content {
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
margin: 0 auto;
height: 7rem;
width: 50rem;
max-width: 90%;
border-left: 1rem solid @color1;
border-top: 1rem solid @color1;
}
> .content::before {
content: '';
width: ~'calc(50% + 50vw)';
height: 1rem;
position: absolute;
top: -1rem;
left: 0;
background: @color1;
}
> .content > .text {
width: 50%;
padding: 0 1rem;
font-size: 2rem;
text-align: center;
}
> .content > .button {
position: relative;
width: 40%;
height: 4rem;
padding: 0 1rem;
font-size: 1rem;
text-align: center;
line-height: 4rem;
background: @color1;
transition: background 100ms cubic-bezier(.72, .09, .48, .93);
}
> .content > .button:hover {
background: @color2;
cursor: pointer;
transition: background 300ms cubic-bezier(.72, .09, .48, .93);
}
> .content > .button::after {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateX(-50%) translateY(-50%);
width: 0;
height: 0;
border-top: 1rem solid transparent;
border-bottom: 1rem solid transparent;
border-left: 1rem solid @color2;
transition: transform 200ms cubic-bezier(.72, .09, .48, .93);
}
> .content > .button:hover::after {
transform: translateX(0) translateY(-50%);
}
> .content2 {
position: relative;
top: -1rem;
overflow: hidden;
margin: 0 auto;
height: 20rem;
width: 50rem;
max-width: 90%;
font-size: .7rem;
color: #777;
padding: 2rem;
text-align: right;
}
> .content2::after {
content: '';
position: absolute;
top: 0;
left: 0;
height: 100%;
width: ~'calc(100% - 2rem)';
border: 1rem solid @color1;
transform: skewY(10deg) translateY(-75%);
@media screen and (max-width: 500px) {
transform: translateY(-70%);
}
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.