luistavares

CSS - Menu fixo

Oct 25th, 2022 (edited)
845
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.47 KB | Source Code | 0 0
  1. <html lang="pt-br">
  2.     <head>
  3.         <head>
  4.             <meta charset="utf-8">
  5.             <title>Menu fixo com CSS</title>
  6.             <style>
  7.                 body{
  8.                     margin: 0;
  9.                 }
  10.  
  11.                 main {
  12.                     padding: 20px;
  13.                     margin-top: 30px;
  14.                 }
  15.  
  16.                 .menu {
  17.                     position: fixed;
  18.                     top: 0px;
  19.                     left: 0px;  
  20.                     width: 100%;
  21.                     background-color: black;    
  22.                 }
  23.  
  24.                 .menu a {
  25.                     font-size: 24px;
  26.                     text-decoration: none;
  27.                     display: block;
  28.                     float: left;
  29.                     width: 100px;    
  30.                     padding: 14px 20px;
  31.                     color: white;
  32.                     background-color: black;
  33.                 }
  34.  
  35.                 .menu a:hover {
  36.                     color: black;
  37.                     background-color: white;
  38.                 }
  39.             </style>
  40.         </head>
  41.     </head>
  42.     <body>
  43.         <nav class="menu">
  44.             <a href="#">Inicial</a>
  45.             <a href="#">Sobre</a>
  46.             <a href="#">Contato</a>
  47.         </nav>
  48.         <main>
  49.             <script>
  50.                 for (var i=1; i<=30; i++)
  51.                    document.write("<p>Parágrafo "+i+"</p>")
  52.             </script>
  53.         </main>
  54.     </body>
  55. </html>
  56.  
Advertisement
Add Comment
Please, Sign In to add comment