css_position_absolute.html 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  5. <title>Printed document</title>
  6. <style type="text/css">
  7. body {
  8. font-family: sans-serif;
  9. font-size: 10pt;
  10. background: #eee;
  11. }
  12. div.absolute {
  13. border: 2px dotted green;
  14. position: absolute;
  15. padding: 0.5em;
  16. text-align: center;
  17. vertical-align: middle;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <!--
  23. <div class="absolute" style="left: 20px; right: 20px;">
  24. left/right
  25. </div>-->
  26. <div class="absolute" style="top: 40px; left: 40px;">
  27. top/left
  28. </div>
  29. <div class="absolute" style="top: 40px; right: 40px;">
  30. top/right
  31. </div>
  32. <div class="absolute" style="top: 80px; left: 40px; right: 40px;">
  33. top/left/right
  34. </div>
  35. <div class="absolute" style="top: 160px; left: 160px; right: 160px; bottom: 160px; ">
  36. top/left/right/bottom
  37. </div>
  38. <div class="absolute" style="bottom: 40px; right: 40px;">
  39. bottom/right
  40. </div>
  41. <div class="absolute" style="bottom: 40px; left: 40px;">
  42. bottom/left
  43. </div>
  44. <div class="absolute" style="bottom: 80px; left: 40px; right: 40px;">
  45. bottom/left/right
  46. </div>
  47. </body>
  48. </html>