overflow-hidden-2-ref.html 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <style>
  5. .box1 {
  6. width: 400px;
  7. height: 400px;
  8. background-color: slateblue;
  9. position: absolute;
  10. }
  11. .translate {
  12. width: 200px;
  13. height: 200px;
  14. background-color: black;
  15. transform: translate(150px, 150px);
  16. }
  17. .box2 {
  18. width: 100px;
  19. height: 100px;
  20. background-color: orangered;
  21. position: absolute;
  22. }
  23. .box3 {
  24. position: relative;
  25. width: 100px;
  26. height: 100px;
  27. background-color: greenyellow;
  28. top: -90px;
  29. left: -120px;
  30. }
  31. </style>
  32. </head>
  33. <body>
  34. <div class="box1">
  35. <div class="translate">
  36. <div class="box2"><div class="box3"></div></div>
  37. </div>
  38. </div>
  39. </body>
  40. </html>