How to keep my navigation bar stick to the top?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kubisztal
    New Member
    • Oct 2017
    • 4

    How to keep my navigation bar stick to the top?

    Im trying to get my nagivation bar to stick to the top of the page but cant for some reason. I tried looking up and i tried a few things but they didnt work.

    Code:
    body {background-color:black;}
         ul {
         list-style-type: none;
         margin: -8;
         padding-bottom: 0px;
         padding-top: 0px;
         overflow:hidden;
         background-color:rgb(235,0,0);
         margin-top: 5px;
         font-family: ariel;
         }
        li {
         padding-left: 35%;
        }
        li a {
        display: inline;
        float: left;
        text-decoration: none;
        padding-left: 25px;
        padding-top: 20px;
        padding-right: 25px;
        padding-bottom: 20px;
        }
        li a:link{
        color:white;
        text-decoration: none;
        }
        li a:visited{
        color:purple;
        text-decoration: none;
        }
        li a:hover{
        background-color:rgb(200,0,0);
        text-decoration: none;
        margin: auto;
        }
        li a:active{
        color:rgb(100,100,100);
        text-decoration: none;
        }
    As you can see i use ul,li and a href tags to make the nav bar and to get it in a horizontal form i use float: left Thanks!
  • Exequiel
    Contributor
    • Jul 2012
    • 288

    #2
    just put this to your css in ul
    Code:
    position: fixed;

    Comment

    • kubisztal
      New Member
      • Oct 2017
      • 4

      #3
      Hey, thanks a lot for help :)

      Comment

      Working...