CSS老师授课3-float

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5 <title>无标题文档</title>
 6 <style type="text/css">
 7 *{
 8     margin:0px;
 9     padding:0px;}
10 .a
11 {
12     width:200px;
13     height:400px;
14     border:1px double red;}
15 </style>
16 </head>
17 
18 <body>
19 <div class="a" style="float:left;">1</div>
20 <div class="a" style="float:right;">2</div>
21 <div class="a" style="float:left;">3</div>
22 <div class="a" style="float:right;">4</div>
23 <div class="a" style="float:left;">5</div>
24 <div class="a" style="float:right;">6</div>
25 <div class="a" style="float:left;">7</div>
26 <div class="a" style="float:right;">8</div>
27 
28 </body>
29 </html>

无标题文档

1
2
3
4
5
6
7
8
原文地址:https://www.cnblogs.com/tonyhere/p/5517697.html