Nenhuma Descrição

offset-parent.html 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <!DOCTYPE html> <title>Basic Visual Test</title>
  2. <style>
  3. @import '/reset.css';
  4. .scroll {
  5. overflow: scroll;
  6. width: 300px;
  7. height: 300px;
  8. background-color: grey;
  9. }
  10. .scroll2 {
  11. width: 600px;
  12. height: 600px;
  13. background-color: darkgrey;
  14. position: relative;
  15. }
  16. .scroll3 {
  17. width: 400px;
  18. height: 400px;
  19. background-color: lightgray;
  20. }
  21. .scroll::before {
  22. content: 'before';
  23. display: block;
  24. height: 300px;
  25. width: 1px;
  26. }
  27. .scroll::after {
  28. content: 'after';
  29. display: block;
  30. height: 300px;
  31. width: 1px;
  32. }
  33. #reference {
  34. width: 200px;
  35. height: 200px;
  36. background-color: red;
  37. box-shadow: inset 0 0 0 1px black;
  38. }
  39. #popper {
  40. width: 100px;
  41. height: 100px;
  42. background-color: rebeccapurple;
  43. box-shadow: inset 0 0 0 1px black;
  44. }
  45. </style>
  46. <div class="scroll scroll2">
  47. <div class="scroll scroll3">
  48. <div class="scroll scroll1"><div id="reference">Reference Box</div></div>
  49. <div id="popper">Popper Box</div>
  50. </div>
  51. </div>
  52. <script type="module">
  53. import { createPopper } from '../dist/popper.js';
  54. const reference = document.querySelector('#reference');
  55. const popper = document.querySelector('#popper');
  56. window.instance = createPopper(reference, popper, {
  57. placement: 'right',
  58. });
  59. </script>