SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Word link

  1. #1
    SitePoint Zealot
    Join Date
    Apr 2012
    Posts
    153
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Word link

    After a long layoff I am back editing my site! I have the new base finished. I need to make a word of text a link to another part of the page as well as change colors when hovering. I have done this with buttons but not text before. Thank you for your help!

  2. #2
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,116
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Hello,

    Do you mean a named anchor? linking to an id in the page?
    HTML Code:
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>untitled</title>
    <style>
     a {
       color: red;
     }
     a:hover {
       color: blue;
     }
    </style>
    </head>
    <body>
      <p><a href="#example">Example link</a></p>
      <h2 id="example">Blah</h2>
    </body>
    </html>

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2012
    Posts
    153
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure exactly. One of the words on a page needs to link to another page on the site. for example: sign up here. Here is supposed to be a link to the sign up page.

  4. #4
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,116
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Then you're just wanting a regular link, the href attribute can have a relative or absolute URL
    HTML Code:
    This is a <a href="/example.html">link relative to site root</a> and here's an
    <a href="http://google.com/">absolute link</a>.

  5. #5
    SitePoint Zealot
    Join Date
    Apr 2012
    Posts
    153
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah that makes sense. Does it matter if the link is before or after the word to be linked?

  6. #6
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,300
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by shakmbakm View Post
    Does it matter if the link is before or after the word to be linked?
    It "wraps around" it, so to speak:

    Code:
    <a href="/example.html">Word(s) to be linked</a>


Tags for this Thread

Bookmarks

Posting Permissions

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