Home  >  Article  >  Web Front-end  >  How to write a circle in css

How to write a circle in css

藏色散人
藏色散人Original
2021-06-01 10:43:582431browse

How to write a circle in css: first prepare an empty html structure; then place an empty div in it; then add a background; and finally achieve the circular effect by adding the border-radius attribute.

How to write a circle in css

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

First prepare an empty html structure, and then place an empty div in it, as shown in the figure below

How to write a circle in css

Then remove some unique features in the browser Style, as shown in the figure below, remove the margins and other styles

How to write a circle in css

#Then remove some unique styles in the browser, as shown in the figure below, remove the margins and other styles

How to write a circle in css

Then we give this style a width and height, and add a background, as shown below

How to write a circle in css

Finally, The most critical thing is to add the border-radius attribute to the style, whose value is half of the width or height, as shown in the figure below

How to write a circle in css

Finally run the program, and you will be in the interface I saw a circle as shown in the picture below

How to write a circle in css

To sum up, to draw a circle in HTML5, you must first define a square div, and then set border-radius to the div Half the length is enough

Recommended learning: "css video tutorial"

The above is the detailed content of How to write a circle in css. 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