Jump to content


Image Border


6 replies to this topic

#1 Hip Hop Artist

    Young Padawan

  • Members
  • Pip
  • 152 posts
  • Gender:Male
  • Location:Canada

Posted 26 December 2006 - 04:42 PM

I have used php to randomize banners that are going to be advertised on my site. the images have a purple border around them, but i never used a tag to put a border there. To see it go to www.toon-workshop.scott-brown.net (this is a temporary domain)

You may have to refresh the page to see the image with the border. How do i get rid of it?

#2 bay

    Young Padawan

  • Members
  • Pip
  • 105 posts
  • Gender:Male
  • Location:Chicago, IL USA

Posted 26 December 2006 - 04:47 PM

That's an easy fix. What's happening is a border is getting added because the banner is being hyperlinked to a website.

To fix it, just set the border="0" or since you are using a CSS file, just add this to it:
a img { border:0px; }

edit: put it in a code box :)

Edited by bay, 26 December 2006 - 04:48 PM.


#3 Hip Hop Artist

    Young Padawan

  • Members
  • Pip
  • 152 posts
  • Gender:Male
  • Location:Canada

Posted 26 December 2006 - 06:06 PM

alright thank you. It worked perfectly :)

#4 blacky

    Young Padawan

  • Members
  • Pip
  • 34 posts
  • Gender:Male

Posted 26 December 2006 - 06:19 PM

i dont think it needs the "a" before the "img"... but its a small thing :)

#5 Davey

    P2L Jedi

  • Members
  • PipPipPip
  • 620 posts
  • Location:Perth, Scotland
  • Interests:Creativity, Adrenaline, Etc

Posted 26 December 2006 - 07:00 PM

i usually just create the class .img {border:0} and apply it to any images i dont want borders on.. depending on encoding to validate u have to use css as opposed to the old border="0"

#6 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 27 December 2006 - 12:59 PM

It's easiest to use the "a img" selector as it will only apply the 0 border property to linked images. It saves bandwidth because you don't have to go around adding classes to all of your linked images (assuming you have multiple images). You also don't have to worry about possible complications when redefining what images do have borders.
i.e.
img { boder: 1px solid black; }
/* As of this point in the code, all images have a border */
img { border:0; }
/* Now, no image has a border.  Adding an "a" before "img" will fix that no matter which way you're going */

p.s. Moved to proper category.

#7 Davey

    P2L Jedi

  • Members
  • PipPipPip
  • 620 posts
  • Location:Perth, Scotland
  • Interests:Creativity, Adrenaline, Etc

Posted 27 December 2006 - 01:02 PM

View Postrc69, on Dec 27 2006, 05:59 PM, said:

It's easiest to use the "a img" selector as it will only apply the 0 border property to linked images. It saves bandwidth because you don't have to go around adding classes to all of your linked images (assuming you have multiple images). You also don't have to worry about possible complications when redefining what images do have borders.
i.e.
img { border: 1px solid black; }
/* As of this point in the code, all images have a border */
img { border:0; }
/* Now, no image has a border.  Adding an "a" before "img" will fix that no matter which way you're going */

p.s. Moved to proper category.


that makes sense... shall use that in future, tho my sites are tiny and my hosting package is pretty big so at the minute bandwidth isn't really an issue just now





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users