In the previous article "Using HTML/CSS to create interesting dynamic wavy text lines", I introduced how to use HTML/CSS to create dynamic wavy text lines. Interested friends can Go and find out~
This article will continue to introduce to you how to use css to realize a circle with a gradient border.
First of all, let me give you a brief introduction to the implementation idea: I will create two divs, one is an external div with the class name outer_circle
, and the other is the class name inner_circle# The inner div of ##; the outer div contains a large circle with a gradient color, and the inner div contains a small white circle that serves as the inner end of the circle, creating the border of the circle.
<!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title></title> <style> .outer_circle { position: relative; margin: 50px; width: 100px; height: 100px; border-radius: 50%; background: #ffffff; } .inner_circle { background-image: linear-gradient( to bottom, rgb(123, 93, 255) 0%, rgb(56, 225, 255) 100%); content: ''; position: absolute; top: -20px; bottom: -20px; right: -20px; left: -20px; z-index: -1; border-radius: inherit; } </style> </head> <body> <div class="outer_circle"> <div class="inner_circle"></div> </div> </body> </html>The effect is shown below:
linear-gradient()The function draws a circle with a gradient border. The function of
linear-gradient() is to create a picture that represents a linear gradient of two or more colors.
linear-gradient()Function syntax such as:
.class_name { background-image: linear-gradient(direction, color1, color2 }Parameters: $direction: Specify the direction of gradient movement. $color1: Specify the first color scale. $color2: It specifies the second color scale. Other usage means:
/* 从上到下,蓝色渐变到红色 */ linear-gradient(blue, red); /* 渐变轴为45度,从蓝色渐变到红色 */ linear-gradient(45deg, blue, red); /* 从右下到左上、从蓝色渐变到红色 */ linear-gradient(to left top, blue, red); /* 从下到上,从蓝色开始渐变、到高度40%位置是绿色渐变开始、最后以红色结束 */ linear-gradient(0deg, blue, green 40%, red);The PHP Chinese website platform has a lot of video teaching resources. Everyone is welcome to learn "
The above is the detailed content of Teach you how to draw a circle with a gradient border using CSS!. For more information, please follow other related articles on the PHP Chinese website!

In this post, Blackle Mori shows you a few of the hacks found while trying to push the limits of Cohost’s HTML support. Use these if you dare, lest you too get labelled a CSS criminal.

Custom cursors with CSS are great, but we can take things to the next level with JavaScript. Using JavaScript, we can transition between cursor states, place dynamic text within the cursor, apply complex animations, and apply filters.

Interactive CSS animations with elements ricocheting off each other seem more plausible in 2025. While it’s unnecessary to implement Pong in CSS, the increasing flexibility and power of CSS reinforce Lee's suspicion that one day it will be a

Tips and tricks on utilizing the CSS backdrop-filter property to style user interfaces. You’ll learn how to layer backdrop filters among multiple elements, and integrate them with other CSS graphical effects to create elaborate designs.

Well, it turns out that SVG's built-in animation features were never deprecated as planned. Sure, CSS and JavaScript are more than capable of carrying the load, but it's good to know that SMIL is not dead in the water as previously

Yay, let's jump for text-wrap: pretty landing in Safari Technology Preview! But beware that it's different from how it works in Chromium browsers.

This CSS-Tricks update highlights significant progress in the Almanac, recent podcast appearances, a new CSS counters guide, and the addition of several new authors contributing valuable content.

Most of the time, people showcase Tailwind's @apply feature with one of Tailwind's single-property utilities (which changes a single CSS declaration). When showcased this way, @apply doesn't sound promising at all. So obvio


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Notepad++7.3.1
Easy-to-use and free code editor

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 English version
Recommended: Win version, supports code prompts!
