Draw a concentric circle with CSS3

Source: Internet
Author: User
This time to bring you to draw a concentric circle with CSS3, with CSS3 draw a concentric circle of attention to what, the following is the actual case, together to see.

Basic ideas

First of all, you have to draw three round bar, how do the three circles overlap to a piece? This has to be controlled by-margin.

<p id= "Tongxin" >    <p id= ' t1 ' ></p>    <p id= "T2" ></p>    <p id= "T3" ></p ></p>

Css

        #t1 {            float:left;            width:150px;            height:150px;            Background:pink;            border-radius:75px;        }        #t2 {                float:left;            width:100px;            height:100px;            Margin-left:-125px;/*move to left 125px*/            margin-top:25px;/* move to bottom 25px*/            background:green;            border-radius:50px;        }        #t3 {            float:left;            width:50px;            height:50px;            Margin-left:-100px;/*move left 100px*/            margin-top:50px;            Background:yellow;            border-radius:25px;        }

Results


Code Analysis

How do you understand the above code? Like the margin-left:-125px in T2. margin-top:25px; Look at the picture below.

-125 means move 125px,25 to the left to move 25px down. Why is the left mobile 125px, this depends on your junior high school math how. The distance between the two centers. Large circle radius of 75px, Medium circle radius 50px. This means that the distance between the circle and the circle is 125px.

Moving vertically 25px is because the center distance of the vertical direction is 25px.

Believe that you have read the case of this article you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!

Recommended reading:

CSS selector use of the detailed

Specific tips for using CSS margin

Refine the style of a radio box, check box

Bottom-level rules for CSS precedence calculations

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.