Advertisement
NickAndNick

JavaScript. Полупрозрачный фон

Nov 9th, 2013
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.93 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="ru">
  3. <head>
  4.     <meta charset="utf-8">
  5.     <style>
  6.         html, body, div {
  7.             padding: 0;
  8.             margin: 0;
  9.             width: 100%;
  10.             height: 100%;
  11.         }
  12.         #bg {
  13.             position: fixed;
  14.             top: 0;
  15.             left: 0;
  16.             background: url('http://www.htmlcodetutorial.com/tables/deepsea.gif');
  17.             opacity: 1;
  18.         }
  19.         #field {
  20.             position: fixed;
  21.             top: 0;
  22.             left: 0;
  23.         }
  24.         #test {
  25.             margin: 10px;
  26.             font-size: 3em;
  27.             color: #FFF;
  28.         }
  29.     </style>
  30.     <script>
  31.         function setOpacity() { bg.style.opacity = 0.5; }
  32.         window.onload = function() { test.onclick = setOpacity; }
  33.     </script>
  34. </head>
  35. <body>
  36.     <div id="bg"></div>
  37.     <div id="field">
  38.         <a id="test" href="#">тест</a>
  39.     </div>
  40. </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement