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:
- Understand the square's drawing.
- Understand the circular drawing.
- Understand what is positioning.
- 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