"CSS" How to use CSS to do a love

Source: Internet
Author: User

Abstract: HTML tags are relatively simple, getting started very quickly, but CSS is a need for us to dig deep things, many of the style attributes within the grasp of a few commonly used can achieve very good-looking results, below I will teach you how to use CSS to do a love. Pre-Preparation knowledge:
    1. Understand the square's drawing.
    2. Understand the circular drawing.
    3. Understand what is positioning.
    4. Understand how to rotate.
Not much to say, first teach you how to use CSS to draw a circle.
. DISC1 {    width: 100px;     height: 100px;     Border:1px solid red;     background-color: red;     margin:300px 0px 0px 300px;     Border-radius:100%;     float:left;}

Since our love is made up of two circles and a square, we need another round.

. DISC2 {    width: 100px;     height: 100px;     Border:1px solid red;     background-color: red;     margin:250px 0px 0px 0px;     Border-radius:100%;     float:left;     position: relative;     Right: 50px;}

In the third step we need to make a square.

. Square {    width: 100px;     height: 100px;     Border:1px solid red;     background-color: red;     margin: 300px 0px 0px 0px;     float: left;     position: relative;     Right: 152px;}

The effect has been basically done, but we also need to adjust the angle of love, then we need to use our CSS style transform in the Rotate attribute.

We had to rotate the three div angles so we put the three div inside a div. The specific code is as follows:

. Main {    transform: rotate (45deg);     margin: 300px;}

To do so now, our love has been made. As follows:

All the code is as follows (contains HTML code and CSS code)

1 <!DOCTYPE HTML>2 <HTML>3     <Head>4         <MetaCharSet= "Utf-8" />5         <Linkhref= "Css/square.css"rel= "stylesheet"type= "Text/css">6         <title></title>7     </Head>8     <Body>9         <Divclass= "Main">Ten             <Divclass= "DISC1"></Div> One             <Divclass= "DISC2"></Div> A             <Divclass= "Square"></Div> -         </Div> -     </Body> the </HTML>
1 *{2 margin:0px;3 padding:0px;4}5 . Main{6 Transform:Rotate (45deg);7 margin:300px;8}9 . DISC1{Ten width:100px; One Height:100px; A Border:1px solid Red; - Background-color:Red; - margin:300px 0px 0px 300px; the Border-radius:100%; - float: Left; -} - . DISC2{ + width:100px; - Height:100px; + Border:1px solid Red; A Background-color:Red; at margin:250px 0px 0px 0px; - Border-radius:100%; - float: Left; - position:relative; -  Right:50px; -} in . Square{ - width:100px; to Height:100px; + Border:1px solid Red; - Background-color:Red; the margin:300px 0px 0px 0px; * float: Left; $ position:relative;Panax Notoginseng  Right:152px; -}

You are welcome to leave comments in the comment area.

"CSS" How to use CSS to do a love

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.