Advertisement
LegoDrifter

WebStorm 5

Jul 2nd, 2020
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport"
  6. content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8. <link rel="stylesheet" href="css/style.css">
  9. <title>CSS Positioning</title>
  10. </head>
  11. <body>
  12. <div id="box-1" class="box"></div>
  13. <div id="cnt">
  14. <div id="box-2" class="box"></div>
  15. <div id="box-3" class="box"></div>
  16. </div>
  17. <div id="box-4" class="box"></div>
  18. <div id="box-5" class="box"></div>
  19. </body>
  20. </html>
  21.  
  22.  
  23. body{
  24. height:4000px;
  25. }
  26. #cnt{
  27. position: relative;
  28. width: 500px;
  29. height: 500px;
  30. background: darkgray;
  31.  
  32. }
  33. .box
  34. {
  35. width: 100px;
  36. height: 100px;
  37. }
  38. #box-1{
  39. position: relative;
  40. top: 50px;
  41. left: 50px;
  42. background: red;
  43. z-index: 1;
  44. }
  45. #box-2{
  46. position: absolute;
  47. top: 100px;
  48. left: 100px;
  49. background: yellow;
  50. }
  51. #box-3{
  52. background: green;
  53. }
  54. #box-4{
  55. position: fixed;
  56. background: blue;
  57. }
  58. #box-5{
  59. position: sticky;
  60. top: 0;
  61. background: orange;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement