Advertisement
1xptolevitico69

Javascript create element Div

Jan 18th, 2022
932
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.01 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <title>Javascript create element Div</title>
  8.     <style>
  9.  
  10.     .tube {
  11.       position: absolute;
  12.       top: 10px;
  13.       left: 10px;
  14.       background-color: red;
  15.       text-decoration: none;
  16.       text-align: center;
  17.       color: snow;
  18.       font-family: arial black;
  19.       padding: 5px 20px;
  20.     }
  21.  
  22.      .div {
  23.         border: 5px solid red;
  24.         display: inline-block;
  25.         position: absolute;
  26.         top: 100px;
  27.         padding: 50px;
  28.     }
  29.  
  30.  
  31.  
  32. </style>
  33. </head>
  34. <body>
  35.  
  36.   <a class='tube' href='https://www.youtube.com/watch?v=1eKDwXPO15Q' target='_blank'>See it on YouTube</a>
  37.  
  38.  
  39.   <script>
  40.  
  41.     div = document.createElement('div');
  42.     document.body.appendChild(div);
  43.     div.innerHTML = 'Javascript create element div';
  44.     div.className = 'div';
  45.  
  46.  
  47. </script>
  48. </body>
  49. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement