Search code examples
htmlhtml-listsheading

How to make HTML navigation bar on the same line as the heading


How do I get my heading and navigation bar to both be on the same line? At the top of the page like you'll see most websites have?


Solution

  • HTML:

    <div class="heading">
        <div class="A">
        </div>
        <div class="B">
        </div>
    
    </div>
    

    CSS:

    .heading {
          
        width:100%;
        height:50px;
        margin-top:0px;
        background-color: red;
    
    }
    
    .A {
        width: 20%;
        height: 100%;
        margin: 0px;
        float:left;
        background-color: blue;
    }
    
    .B {
        width: 80%;
        height: 100%;
        margin: 0px;
        float:left;
        background-color: orange;
    }
    

    I presume you have no experience with HTML / CSS?

    Maybe you should document your question more...