Geen omschrijving

containing-block.html 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE html> <title>Basic Visual Test</title>
  2. <style>
  3. @import '/reset.css';
  4. #reference {
  5. width: 200px;
  6. height: 200px;
  7. background-color: red;
  8. box-shadow: inset 0 0 0 1px black;
  9. }
  10. #popper {
  11. width: 100px;
  12. height: 100px;
  13. background-color: rebeccapurple;
  14. box-shadow: inset 0 0 0 1px black;
  15. }
  16. #containing-block {
  17. background: gray;
  18. width: 400px;
  19. height: 400px;
  20. overflow: auto;
  21. will-change: transform;
  22. }
  23. #containing-block::before {
  24. content: '';
  25. display: block;
  26. height: 200px;
  27. width: 1px;
  28. }
  29. #containing-block::after {
  30. content: '';
  31. display: block;
  32. height: 200px;
  33. width: 1px;
  34. }
  35. </style>
  36. <div id="containing-block">
  37. <div id="reference">Reference Box</div>
  38. <div id="popper">Popper Box</div>
  39. </div>
  40. <script type="module">
  41. import { createPopper } from './dist/popper.js';
  42. const reference = document.querySelector('#reference');
  43. const popper = document.querySelector('#popper');
  44. window.instance = createPopper(reference, popper, {
  45. strategy: 'fixed',
  46. });
  47. </script>