Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Apr 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry CSS Navigation bar links dont fill up the boxes

    Hi, this is my first post on here so go easy on me please. I've been looking at this code for the past few hours and getting extremely frustrated since i can't seem to find what the problem is. My goal is to have a navigation bar, with boxes that if you click them, you get to another page. Here's the thing, I can only click the text in the boxes, but nowhere else in them. I'll post my entire code here, I know it is a dull explanation, but I am quite new to this and nothing on the whole internet can seem to help me for some odd reason.

    Code:
    <!DOCTYPE html>
    
    <head>
    <title>Dare 2 Care</title>
    </head>
    <body>
    <center><p><img src="images/Dare2Care PNG Transparent 1.png"></p></center>
    <body background="animaltribal3.jpg">
    
    <style>
    #navbar {
    width:100%;
    height:40px;
    background-color:#373737;
    }
    
    #navbar ul {
    width:80%;
    margin:0 auto 0 auto;
    }
    
    #navbar ul li {
    float:left;
    color:#4E80FF;
    padding: 0 20px 0 20px;
    border-right:1px solid #FFF;
    border-left:1px solid #FFF;
    height:40px;
    list-style:none;
    display:block;
    line-height:40px;
    text-align:center;
    cursor:pointer;
    }
    
    #navbar ul li:hover {
    display:block;
    background-color:#CCC;
    }
    a:link {color:#4E80FF; text-decoration:none; display:block}
    a:visited {color:#4E80FF; text-decoration:none; display:block}
    a:hover {color:#4E80FF; text-decoration:none; display:block} 
    a:active {color:#4E80FF; text-decoration:none;display:block}
    </style>
    
        <div id="navbar"><font face="arial">
    
            <ul>
                <li><a href="index.html">Home</a></li>
                <li><a href="blog.html">Blogs</a></li>
                <li><a href="photos.html">Pictures</a></li>
                <li><a href="videos.html">Video's</a></li>
                <li><a href="about.html">About</a></li>
            </ul>
    
        </div></font>
    </style>
    </body>

  • #2
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,743
    Thanks
    0
    Thanked 244 Times in 239 Posts
    Hi there Chelesty,

    and a warm welcome to these forums.

    Try it like this...
    Code:
    
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    
    <title>Dare 2 Care</title>
    
    <style>
    body {
        background-image:url(animaltribal3.jpg);
        font-faimily:arial,sans-serif;
     }
    #dare {
        display:block;
        margin:auto;
     }
    #navbar {
        height:40px;
        background-color:#373737;
     }
    #navbar ul {
        position:relative;
        float:right;
        right:50%;
        padding:0;
        margin:0;
        list-style-type:none;
     }
    #navbar ul li {
        position:relative;
        left:50%;
        float:left;
        color:#4e80ff;
        border-right:1px solid #fff;
        border-left:1px solid #fff;
     }
    #navbar ul a{
        display:block;
        line-height:40px;
        color:#4e80ff; 
        text-decoration:none;
        padding: 0 20px 0 20px;
     }
    #navbar ul a:hover {
        background-color:#ccc;
     }
    </style>
    
    </head>
    <body>
    
    <img id="dare" src="images/Dare2CarePNGTransparent1.png" alt="">
    
    <div id="navbar">
    <ul>
     <li><a href="index.html">Home</a></li>
     <li><a href="blog.html">Blogs</a></li>
     <li><a href="photos.html">Pictures</a></li>
     <li><a href="videos.html">Video's</a></li>
     <li><a href="about.html">About</a></li>
    </ul>
    </div>
    
    </body>
    </html>

    coothead

  • #3
    New to the CF scene
    Join Date
    Apr 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks coothead! Now I can atleast continue xD

  • #4
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,743
    Thanks
    0
    Thanked 244 Times in 239 Posts

    No problem, you're very welcome.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •