How Can I Create Inverted Scooped Corners in CSS Using Only CSS?

Linda Hamilton
Release: 2024-11-19 14:52:03
Original
411 people have browsed it

How Can I Create Inverted Scooped Corners in CSS Using Only CSS?

Creating Inverted Scooped Corners Using Pure CSS

In CSS, creating rounded corners is straightforward using the border-radius property. However, achieving inverted scooped corners, where the corners curve inward, requires a more advanced technique.

To create inverted scooped corners, we'll employ the following approach:

  • Create a transparent square with hidden overflow.
  • Place a transparent circle with a box shadow inside the square.
  • Adjust the position of the circle to reveal only a quarter of it.

Code Implementation

#box {
  position: relative;
  width: 200px;
  height: 50px;
  background-color: blue;
  border-radius: 9999px 0 0 9999px;
  margin: 30px;
  text-align: center;
  color: #fff;
  padding-top: 10px;
}

#top,
#bottom {
  position: absolute;
  height: 30px;
  width: 30px;
  right: 0;
  overflow: hidden;
}

#top {
  top: -30px;
}

#bottom {
  bottom: -30px;
}

#top::before,
#bottom::before {
  content: '';
  position: absolute;
  right: 0;
  height: 200%;
  width: 200%;
  border-radius: 100%;
  box-shadow: 10px 10px 5px 100px blue;
  z-index: -1;
}

#top::before {
  top: -100%;
}
Copy after login

The above is the detailed content of How Can I Create Inverted Scooped Corners in CSS Using Only CSS?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template