Get the App
SLTechnology News&Howtos  ›  Development  › 

How to hide half of a circle by css

Shulou Source: shulou.com Published: 2022-06-02 07:16:29 09月21日 Update

This article mainly introduces css how to hide half of a circle, with a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

Methods: 1, the circular element is placed in the div container; 2, the height of the div is set to the radius length of the circle, and the width of the div is set to the diameter and length of the circle, so that the div can only be put into half a circle; 3, add the "overflow: hidden" style to the div element, and hide the half circle outside the div.

The operating environment of this tutorial: windows10 system, CSS3&&HTML5 version, Dell G3 computer.

How does css hide half of a circle?

In css, you can first put a circular element into a div, and then set the height of the div to the radius length of the circle and the width to the diameter length of the circle.

At this point, you can use the overflow property to hide the circular part that exceeds the div.

Examples are as follows:

Title .mask2 {width: 100pxpolitical height: 50pxpolitical height: hidden;} .mask2 {width: 100pxpolitical height: 100pxpolitical height: 100pxpolitical backgroundmurcolor: cornflowerblue;border-radius: 50px;}

Output result:

Thank you for reading this article carefully. I hope the article "how to hide half of a circle" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and follow the industry information channel. More related knowledge is waiting for you to learn!

Tags: Circle article length element radius width diameter height value interest at the same time containers properties tutorials methods more friends styles environment computer Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi macOS Shulou Information Shulou Tech Info Docker