Use CSS3 border-radius to draw Tai Chi and love patterns
The border-radius in CSS3 can be easily used to draw arcs. If it is only used to make rounded rectangles, it would be too wasteful. Here is an example of using the border-radius of CSS3 to draw Tai Chi and love patterns. , Friends who need it can refer to
太极图
border-radius. In addition to creating a border and rounded corner effect, if you use it in drawing illustrations, it can actually produce an effect. So many different ideas. The author will continue to use it to teach you how to draw Tai Chi pictures today.
View source code HTML
<body> <p class="taichi"> <p class="white-circle"></p> <p class="black-circle"></p> </p> </body>
Because there is a black and a white circle in the Tai Chi diagram, two more p's are placed in the block.
Please open your eyes and look carefully. I will first divide the large block into one white and one black:
View source code CSS
.taichi { position: relative; width: 48px; /* 50 - 2 */ height: 96px; /* 100 - 2 - 2 */ background: #fff; border: 2px solid #000; border-width: 2px 50px 2px 2px; border-radius: 50%; }
General box mode (Box Model) is calculated together with the width and height of the block together with the border width, so we want to make a block with a width and height of 100×100, but if the border width is 2px, then the part inside should be only 96px . What’s special is that the author directly sets the width of the right border to 50px, so the width inside the block only needs 48px.
When this is set and the border-radius rounded corner effect is added, it will become~
Hehe~There is already one black and one white block. , then add a white circle first:
View source code CSS
.white-circle { position: absolute; top: 0; left: 50%; background: #fff; border-radius: 50%; width: 48px; height: 48px; }
Here is to directly generate a complete white circle and place it in the middle of the upper half:
The black circle is placed in the lower half:
View the source code CSS
.black-circle { position: absolute; top: 50%; left: 50%; background: #000; border-radius: 50%; width: 48px; height: 48px; }
It looks like there are already 9 images~
Finally, there are still two small dots of opposite colors in these two circles. For these two small dots, we only need to use ::after pseudo-elements (Pseudo-elements). That’s it:
View source code CSS
.white-circle::after { content: ""; position: absolute; top: 17px; /* (50-16)/2 */ left: 17px; /* (50-16)/2 */ background: #000; border-radius: 50%; width: 16px; height: 16px; } .black-circle::after { content: ""; position: absolute; top: 17px; /* (50-16)/2 */ left: 17px; /* (50-16)/2 */ background: #fff; border-radius: 50%; width: 16px; height: 16px; }
Will~ Isn’t it amazing! ?
爱
The above teaches you how to use border-radius to draw Tai Chi diagrams, and the following will teach you how to use the rounded corner effect as well. Love.
We only need a p block:
<body> <p class="heart"></p> </body>
Then specify the width and height of the block:
View source code CSS
.heart { position: relative; width: 140px; height: 115px; }
The heart is divided into the left and right blocks, and the ::before pseudo-elements (Pseudo-elements) are used to generate the left block:
View the source code CSS
.heart::before { content: ""; position: absolute; left: 70px; top: 0; width: 70px; height: 115px; background: red; border-radius: 50px 50px 0 0; }
Because only the rounded corners on the upper left and upper right are set, it becomes a round-headed pillar:
Then I need to change its rotation center point to move it towards Rotate left 45 degrees:
View source code CSS
.heart::before { content: ""; position: absolute; left: 70px; top: 0; width: 70px; height: 115px; background: red; border-radius: 50px 50px 0 0; -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg); -webkit-transform-origin: left bottombottom; -moz-transform-origin: left bottombottom; -o-transform-origin: left bottombottom; transform-origin: left bottombottom; }
transform-origin can change the center point of the element. Like background-position, it accepts two values, the first is to set the horizontal value, and the second is to set the vertical value. The default is center center, now I change it to the lower left:
The right part is the same, but only the rotation center point is changed to the lower right , and rotate to the right:
View source code CSS
.heart::after { content: ""; position: absolute; top: 0; left: 0; width: 70px; height: 115px; background: red; border-radius: 50px 50px 0 0; -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -o-transform: rotate(45deg); transform: rotate(45deg); -webkit-transform-origin: rightright bottombottom; -moz-transform-origin: rightright bottombottom; -o-transform-origin: rightright bottombottom; transform-origin: rightright bottombottom; }
When both sides are generated, a bright red heart will appear:
What~ Mr. Zhong from Zhonghe asked why he couldn't move... It doesn't matter, add an animation animation effect to it:
View source code CSS
.heart { -webkit-animation: jump 1s infinite ease-out; -moz-animation: jump 1s infinite ease-out; -o-animation: jump 1s infinite ease-out; animation: jump 1s infinite ease-out; } @-webkit-keyframes jump { 0%, 60%, 75%, 90%, 100% { -webkit-transform: scale(1); } 15% { -webkit-transform: scale(0.6); } 30% { -webkit-transform: scale(1); } 45% { -webkit-transform: scale(0.7); } } @-moz-keyframes jump { 0%, 60%, 75%, 90%, 100% { -moz-transform: scale(1); } 15% { -moz-transform: scale(0.6); } 30% { -moz-transform: scale(1); } 45% { -moz-transform: scale(0.7); } } @-o-keyframes jump { 0%, 60%, 75%, 90%, 100% { -o-transform: scale(1); } 15% { -o-transform: scale(0.6); } 30% { -o-transform: scale(1); } 45% { -o-transform: scale(0.7); } } @keyframes jump { 0%, 60%, 75%, 90%, 100% { transform: scale(1); } 15% { transform: scale(0.6); } 30% { transform: scale(1); } 45% { transform: scale(0.7); } }
Through Use transform's scale(x, y) to change the size of the heart, so that the entire animation looks like a popping jump:
The above is the entire article Content, I hope it will be helpful to everyone’s learning. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
About the use of window units and percentage units in CSS
How to implement custom "W" in CSS3 "Shaped running trajectory
Use CSS3 to achieve the flashing effect of text looping to the right
The above is the detailed content of Use CSS3 border-radius to draw Tai Chi and love patterns. 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

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
