05-float.html 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. <style>
  8. .outerDiv{
  9. width: 500px;
  10. height: 303px;
  11. border: 1px solid greenyellow;
  12. background-color: rgb(165, 212, 212);
  13. }
  14. .innerDiv{
  15. width: 100px;
  16. height: 100px;
  17. border: 1px solid rebeccapurple;
  18. /* float: left; */
  19. }
  20. .d1{
  21. background-color: bisque;
  22. /* 使用float达到浮动的效果 right就是靠右 */
  23. float: right;
  24. }
  25. .d2{
  26. background-color: rgba(0, 76, 255, 0.227);
  27. /* float: right; */
  28. /* float: left; */
  29. }
  30. .d3{
  31. background-color: rgb(219, 167, 167);
  32. /* float: right; */
  33. /* float: left; */
  34. }
  35. </style>
  36. </head>
  37. <body>
  38. <div class="outerDiv">
  39. <div class="innerDiv d1">框1</div>
  40. <div class="innerDiv d2">框2</div>
  41. <div class="innerDiv d3">框3</div>
  42. </div>
  43. </body>
  44. </html>