How can I make a menubar fixed on the top while scrolling

前端 未结 4 1442
攒了一身酷
攒了一身酷 2020-12-09 19:49

I\'d like to make a menubar, which is fixed on the top of the page while scrolling. Something like the top menu in Facebook.

Also, I want a div holding the logo flo

4条回答
  •  清歌不尽
    2020-12-09 20:01

    This should get you started

     
    
    
    
    body{
        margin-top:50px;}
    .menuBar{
        width:100%;
        height:50px;
        display:block;
        position:absolute;
        top:0;
        left:0;
        }
    .logo{
        float:left;
        }
    .nav{
        float:right;
        margin-right:10px;}
    .nav ul li{
        list-style:none;
        float:left;
        }
    

提交回复
热议问题