Creating Inverted Border-Radius Effects
Question:
Can an inverted border-radius effect be achieved where the corners appear to curve inward?
Answer:
Native CSS's border-radius property does not permit negative values that would result in an inverted effect. However, here's an alternative approach using CSS:
Add four additional elements within the container, ensuring they extend slightly beyond its boundaries. These elements should match the background color of the page, creating an illusion of the page content underneath. Position these elements strategically around the corners and apply a border-radius to achieve the inverted effect.
Code Snippet:
#main {
margin: 40px;
height: 100px;
background-color: #004C80;
position: relative;
overflow: hidden;
}
#main div {
position: absolute;
width: 20px;
height: 20px;
border-radius: 100%;
background-color: #FFF;
}
.top { top: -10px; }
.bottom { bottom: -10px; }
.left { left: -10px; }
.right { right: -10px; }
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3