Home >Web Front-end >CSS Tutorial >How Can I Create a Curved Border with CSS Using SVG?

How Can I Create a Curved Border with CSS Using SVG?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-12-17 17:22:21454browse

How Can I Create a Curved Border with CSS Using SVG?

Creating Curved Borders with CSS

In your quest to enhance your website's aesthetics, you've encountered a challenge in crafting a rounded border with a curved end. To achieve this effect, let's explore a solution that utilizes SVG as the background.

CSS Implementation

Modify your existing CSS code as follows:

.bottom-bar {
  /* ... (existing code) ... */
}

.circle {
  /* ... (existing code) ... */
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='10 10 45 15'  width='64' height='64' fill='%2329a7e8'><path d='M12 24 L52 24 L52 16 C40 16 42 10 32 10 C20 10 22 16 12 16 Z' /></svg>") 0 0/100% 100% no-repeat;
}

SVG Creation

Additionally, you'll need to create an SVG image to serve as the curved background for the border:

<svg xmlns='http://www.w3.org/2000/svg'
  viewBox='10 10 45 15'
  width='64' height='64'
  fill='#29a7e8'>
  <path d='M12 24 L52 24 L52 16 C40 16 42 10 32 10 C20 10 22 16 12 16 Z' />
</svg>

By incorporating this SVG background, you can effectively create the desired curved border effect, giving your website a visually appealing touch.

The above is the detailed content of How Can I Create a Curved Border with CSS Using SVG?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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