SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Feb 2002
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Image links w/o a border?

    I know I've done this before, but I simply can NOT think of the solution... Anyway, how do I get rid of the line around the images that are links?

    Example: <a href="someotherpage.html"><img src="whateverimage.gif"></a>

    TIA! - JACK D.

  2. #2
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    border="0"
    as in:
    <img src="image.gif" alt="alt text" height="32" width="32" border="0">
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  3. #3
    SitePoint Member
    Join Date
    Feb 2002
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    THANKS MUCH! - Jack D.

  4. #4
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alternatively, you could (and perhaps should*) push that kind of 'style' specification out to CSS.

    Code:
    img {
    border: 0px;
    }
    Using the px is optional when the value is 0 as 0px = 0pt = 0em = 0.

    Using CSS to control the border of images (including image links) is the XHTML Strict compliant method.
    The image border attribute does not exist in XHTML Strict (though it does in Frameset and Transitional) as in that version of XHTML borders are expected to be specified in CSS not in the (X)HTML code.

    *Of course, it' not yet essential to be 'Strictly' compliant, but becoming so now will get you into good habits that create code that is clean, well-formed and forward-compatible.

    Just a thought
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  5. #5
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can always set the onclick of the image - if it's not
    really an occasion that needs an anchor.

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  6. #6
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Flawless_koder
    You can always set the onclick of the image - if it's not
    really an occasion that needs an anchor.

    Flawless
    The problem with that is that you lose the pointer cursor when you mouseover it.
    This is still very important for letting the user know that it is actually a link.

    The pointer cursor is such a commonly understood indicator for a link that if an image didn't turn the cursor to a pointer people might understandably assume that it isn't a link after all and not click it

    IMage links don't always look like a button (logos for example).

    Of course you can use CSS to 'fake' the pointer, but it is still much simpler at present to use the <a> tags to do the work for you.

    It is presumably also better for SEs that will recognise it as a proper link.
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  7. #7
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're not making it a "fake cursor" at all.
    You're setting the cursor for the object - nothing fake about that at all.

    When you do - for netscape users ( curse them ) use:

    {
    cursor: pointer;
    cursor: hand;
    }

    Depending on how indepth your coding is there can be
    numerous advantages to using this method rather than
    an href tag ... maintaining a hierarchy of clicked
    objects being one of the highest.
    When you click on the child of the href - the child recieves
    the src Attribute (currentTarget in Netscape).
    This means that the object which initiated the event isn't
    the event handler reference - an can lead to problems with
    assumptions of nextSibling (etc) references.

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  8. #8
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And i wouldn't use this in examples where i'd be expecting
    the SE to look at it.

    For that the case is strong for using anchors.

    Don't get me wrong - use anchors when you can... but
    sometimes the situation does warrant an image.

    The case discussed here might be such an occassion.

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---


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
  •