RWDHTMLCSS.COM

Html & CSS Walkthrough

Previous Home Table of Contents Next

Horizontal Navigation Menu

Navigation Menus

Html Part of Menu

  • Paste this over the div already there at top and bottom on the Html sheet. Meaning get rid of the div there and paste this in its place on the html sheet. The top one goes in between the closing header tag and the opening article tag. The bottom on goes in between the closing article tag and the opening footer tag.


<div class="navbar">
 <a href="index.html">Home</a>
 <a href="sports.html">Sports</a>
 <a href="sitemap.html">Table of Contents</a>
 <a href="classified.html">Classifieds</a>
</div>

  • I put 4 links there. You can change it to however many you want there. I will do the table of contents on another page. But I will have to show you naming the links later after we have a page with content on it. If not interested in the Table of Contents, just skip that page.


CSS Part of Menu

  • .navbar {
    background-color: #4682b4;
    overflow: hidden;
    box-sizing:border-box;
    }

    .navbar a {
    float: left;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight:bold;
    }

    .navbar a:link {
    background-color: #4682b4;
    color: white;
    font-weight:bold;
    }

    .navbar a:visited {
    background-color: #4682b4;
    color: white;
    font-weight:bold;
    }
    .navbar a:hover {
    background-color: #4682b4;
    color: lightblue;
    font-weight:bold;
    }

    .navbar a:active {
    background-color: #4682b4;
    color: red;
    font-weight:bold;
    }


  • On the Css sheet, go to the spot where the .navbar is, get rid of it and copy and paste all of the code above right there.
  • Also, add clear:left; to the article section. When you float left, you have to clear left in the next box under the box you floated left. It is not a good example of floating content and I will explain it better later.

    article {
    clear:left;
    background-color:white;
    color:black;
    box-sizing:border-box;
    padding-top:8px;
    padding-bottom:20px;
    }
  • Overflow:hidden means that any content that will not fit in the box will be hidden. The parts on fonts we will cover on another page. I have yet to do text formatting and fonts.
  • On the next page we are going to finish making our template that we will use for all our pages.


To see what it looks like so far Click Here(opens a new window)

Previous Home Table of Contents Next