www.webdeveloper.com
Results 1 to 6 of 6

Thread: img link border

  1. #1
    Join Date
    Sep 2006
    Posts
    375

    img link border

    I have images as inks and a border around I can't get rid of that has been put in.
    I can't get rid of it .
    I use this and various other with 'a'.

    .imgsub {
    text-decoration:none;
    }

    <a href='homeYr11.php' class='imgsub' ><img src='images/yr11.gif' > </a>

  2. #2
    Join Date
    Jul 2007
    Location
    Cape Town, South Africa
    Posts
    64
    Hi

    The CSS you are looking for is:

    border: 0;

    So:

    img {
    border: 0;
    }

    <a href='homeYr11.php'><img src='images/yr11.gif' /> </a>

  3. #3
    Join Date
    Sep 2006
    Posts
    375
    It workd with img class but not 'a' class as in
    a.imgsub {
    border:0;
    }

    <a href='homeYr11.php' class='imgsub'><img src='images/yr11.gif' /> </a>

  4. #4
    Join Date
    Jul 2007
    Location
    Cape Town, South Africa
    Posts
    64
    OK: difficult to do this without seeing all your code...

    2 issues here:
    1) you can have a border around an image (the border poperty).
    2) you can have a border around an image that is a link (the text-decoration property).

    In the code you have written, you have created a class for a link called imgsub, and you have specified that it have no border.

    You have then applied that class to your link (correctly), but what about the img tag?

    So:

    .imgsub {
    border:0;
    text-decoration: none;
    }

    <a href='homeYr11.php' class='imgsub'><img class='imgsub' src='images/yr11.gif' /> </a>

    If that doesn't work (and although it should work - it is not neccesarily correct mark-up in relation to the rest of your code), your prob may be elsewhere...

  5. #5
    Join Date
    Nov 2006
    Posts
    28
    Quote Originally Posted by jagguy
    It workd with img class but not 'a' class as in
    a.imgsub {
    border:0;
    }

    <a href='homeYr11.php' class='imgsub'><img src='images/yr11.gif' /> </a>
    That's because technically it's the image that it puts a border around, not actually the a element. Don't bother formatting any classes of A, it's about the img.

  6. #6
    Join Date
    Apr 2003
    Location
    UK
    Posts
    2,203
    Try this

    Code:
    <style>
    
    a img{
    border:0px
    }
    
    </style>
    
    <a href="page.htm"><img src="image.jpg"></a>
    The Silent One

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is one with an idea

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles