33_实现边框.html 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. .box{
  9. width: 200px;
  10. height: 200px;
  11. background-color: blue;
  12. padding:1px;
  13. }
  14. .box1{
  15. width: 200px;
  16. height: 200px;
  17. background-color: red;
  18. }
  19. .box2{
  20. position: relative;
  21. }
  22. .box3{
  23. width: 200px;
  24. height: 200px;
  25. background-color: blue;
  26. position: absolute;
  27. top: 0;
  28. left: 0;
  29. padding: 1px;
  30. }
  31. .box4{
  32. width: 200px;
  33. height: 200px;
  34. background-color: green;
  35. position: absolute;
  36. top: 1px;
  37. left: 1px;
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <!-- <div class="box">
  43. <div class="box1"></div>
  44. </div> -->
  45. <div class="box2">
  46. <div class="box3"></div>
  47. <div class="box4"></div>
  48. </div>
  49. </body>
  50. </html>