<div class="container">
<span class="border tl">border-top-left</span>
<span class="border tr">border-top-right</span>
<span class="border bl">border-bottom-left</span>
<span class="border br">border-bottom-right</span>
<h1>Multiple Border-Radius Values</h1>
<p>You probably knew that you can set the border-radius of an element to 4 values, and using shorthand, it goes clock-wise from top, right, bottom, left.</p>
<p>But did you know you can actually set up to 8 values if you separate them? Each corner can have 2 values as you can see in this example.</p>
<pre>
.container {
border-top-left-radius: 37px 140px;
border-top-right-radius: 23px 130px;
border-bottom-left-radius: 110px 19px;
border-bottom-right-radius: 120px 24px;
}</pre>
</div>
body {
font-family: monospace;
}
.container {
border-top-left-radius: 37px 140px;
border-top-right-radius: 23px 130px;
border-bottom-left-radius: 110px 19px;
border-bottom-right-radius: 120px 24px;
display: block;
position: relative;
border: solid 3px #6e7491;
padding: 40px 60px;
max-width: 800px;
width: 70%;
margin: 100px auto 0;
font-size: 17px;
line-height: 28px;
transform: rotate(-1deg);
box-shadow: 3px 15px 8px -10px rgba(0, 0, 0, 0.3);
transition: all 0.13s ease-in;
}
.container:hover {
transform: translateY(-10px) rotate(1deg);
box-shadow: 3px 5px 8px -1px rgba(0, 0, 0, 0.3);
}
.container:hover .border {
transform: translateY(4px) rotate(-5deg);
}
.border {
position: absolute;
transition: all 0.13s ease-in;
}
.border:before,
.border:after {
color: #515d9c;
font-size: 15px;
position: absolute;
}
.tl {
position: absolute;
left: -50px;
top: -63px;
font-weight: 600;
}
.tl:before {
content: "37px";
left: 120px;
top: 30px;
}
.tl:after {
content: "140px";
left: 0px;
top: 80px;
}
.tr {
right: -50px;
top: -63px;
font-weight: 600;
}
.tr:before {
content: "23px";
left: 0;
top: 30px;
}
.tr:after {
content: "130px";
left: 130px;
top: 80px;
}
.bl {
left: -50px;
bottom: -71px;
font-weight: 600;
}
.bl:before {
content: "110px";
left: 120px;
top: -30px;
}
.bl:after {
content: "19px";
left: 0px;
top: -90px;
}
.br {
right: -50px;
bottom: -63px;
font-weight: 600;
}
.br:before {
content: "120px";
left: 0;
top: -30px;
}
.br:after {
content: "24px";
right: -10px;
top: -80px;
}
pre {
background: #edeff5;
padding: 20px;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.