Space between links on a horozontal line question

Discussion in 'HTML & Website Design' started by jawinn, Jun 28, 2006.

  1. #1
    I'm trying to add more space between links on a horozontal line than just a single space. Two or three spaces would be great. For example:

    I have
    link link link link

    I want to have
    link.....link......link.....link (imagine this w/out dots, DP won't let me put in a bunch of spaces)

    This is the code I'm using:
    <a href="http://www.site.com/link">link</a> <a href="http://www.site.com/link">link</a> <a href="http://www.site.com/link">link</a> <a href="http://www.site.com/link">link</a>

    Is there a basic way to do this without using tables?
     
    jawinn, Jun 28, 2006 IP
  2. PFCritics

    PFCritics Peon

    Messages:
    107
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think I know what you're trying to do.

    &nbsp; = a blank space

    So, try something like this:

    <a href="link">link</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="nextlink">nextlink</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="etc">...

    That should be a fairly basic way. Alternatively, you may be able to add right-padding to each link via css.
     
    PFCritics, Jun 28, 2006 IP
    jawinn likes this.
  3. jawinn

    jawinn Active Member

    Messages:
    1,024
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    88
    #3
    Perfect!! I knew it was something basic like that. Thanks a ton.
     
    jawinn, Jun 28, 2006 IP
  4. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #4
    Naw, that's a very bad way to do it. One should not let presentation intrude into the structure. A more correct way to do it would use left and right padding or margin.
    
    a {
        padding: 0 10px;
        }
    
    or
    
    a {
        margin: 0 10px;
        }
    Code (markup):
    cheers,

    gary
     
    kk5st, Jun 29, 2006 IP
  5. brian394

    brian394 Well-Known Member

    Messages:
    226
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    108
    #5
    One thing you can do to ensure you always have an equal amount of spacing in between links (without having to worry about how many &nbsp;'s to use) is to use an unordered list like so...

    
    <style type="text/css">
    ul.links {
     list-style-type: none;
    }
    ul.links li {
     display: inline;
     margin-right: 5em;
    }
    </style>
    
    <ul class="links">
    <li><a href="">link 1</a></li>
    <li><a href="">link 2</a></li>
    <li><a href="">link 3</a></li>
    </ul>
    
    Code (markup):
    And, of course, you can change the margin-right property to whatever you want.
     
    brian394, Jul 1, 2006 IP