1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Linking Help

Discussion in 'HTML & Website Design' started by Web_Dev_Chris, Dec 19, 2016.

  1. #1
    Navigation

    For the link to the Home page, would it be the index.html or web url? I guess index.html is internal and url would be extral but redirecting to the home page. Also, the active isn't working? I cannot get the link to stay highlighted or colour change when clicked on?

    HTML
    <ul class="navigation">
      <li><a href="index.html">Home</a></li>
      <li><a href="about-us.html">About Us</a></li>
      <li><a href="#">Online Guitar Lessons</a></li>
      <li><a href="#">Contact Us</a></li>
    </ul>
    HTML:
    CSS
    .navigation {
         list-style-type: none;
         width: 100%;
        height: 40px;
         background-color: #F4F4F4;
         border: 1px solid #999999;
        box-shadow: 0px 0px 1px #999999;
        border-left: none;
        border-right: none;
        
    }
    .navigation li {
         display: inline-block;
        padding: 11.1px 10px 0 10px;
        
    }
    .navigation li a{        
         color: #000;
         text-decoration: none;
        overflow:hidden;
    }
    .navigation li a:hover {
         color:#0645AD;
         background-color:#E5E5E5;
         padding: 11px 0px;
        
        
    }
    .navigation li a:active{
         color:#0645AD;
         background-color:#E5E5E5;
         padding: 11px 0px;
    }
    Code (CSS):
    All help much appreciated!

    Thanks,
    Chris
     
    Web_Dev_Chris, Dec 19, 2016 IP
  2. badger_

    badger_ Greenhorn

    Messages:
    52
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    20
    #2
    Try this:
    
    .navigation a.current {
           ...
    }
    
    Code (markup):
    
    <ul class="navigation">
         <li><a href="/" class="current">Selected option</a></li>
         <li><a href="/">Normal link</a></li>
         ...
    </ul>
    
    Code (markup):
    Personally I prefer to put one index.html in a directory to have pretty URLs, although this may cause duplicate content issues if someone links to your urls ending in /index.html. I'm not sure what's the best method to avoid this, maybe 301 redirects or using canonical.
     
    badger_, Dec 20, 2016 IP
  3. Web_Dev_Chris

    Web_Dev_Chris Well-Known Member

    Messages:
    222
    Likes Received:
    12
    Best Answers:
    1
    Trophy Points:
    105
    #3
    Ohh, thanks. I was puzzled for a few minutes, than I realised I needed to add the class on each pages link in the nav not just index. Thanks!
     
    Web_Dev_Chris, Dec 20, 2016 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    Besides, that is no what :active is for - :active is for _the action_ - ie, WHEN you click on sometihng. It does not reflect anything BEING "active" (ie, being the current page or similar).
     
    PoPSiCLe, Dec 27, 2016 IP