/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] link border colour

Hi there,
Im trying to make my image link border colour black, but in iexplorer it seems to be purple. can i change them to be black and say black?

Also, im wanting to take away the automatic blue border when i click on a link in iexplorer.. can anyone help?

Princess_funk

to post a comment
CSS

7 Comments(s)

Copy linkTweet thisAlerts:
@disembodiedNov 19.2006 — well a link (text link that is) will not have a border by default since its an inline element and not a block-level element.

As for images that are linked, which would have a border, you change the border in the img CSS (as opposed to the link css)... something like this:

img {

border: none;

}

or

img {

border: 1px solid #000;

}

As for your 'border' (underline?) looking purple, perhaps it is just your screen... if you are using '#000' or '#000000' (the shorthand is just easier) then it is black, no matter what it looks like to you. You can, instead (if you want), use the word 'black' instead of the hex number, but the hex number isn't causing the problem itself (if you are using a WYSIWYG editor perhaps you are thinking you are choosing black when its just a dark purple, so its applying a different hex number then #000).

Hope that helps
Copy linkTweet thisAlerts:
@PRINCESS_FUNKauthorNov 19.2006 — hey there,

thanks for the fast reply, got the border colour working, but by making it an img css it adds a border to all my images, but i just want this on the linked images? how do i link the css to one image but not another?

The other thing wasnt an underline

i havnt seen it before, but its just like an aqua blue square that apears around a link that ive just clicked on, but disapears when i click away from the link?

its not hapening in safari, so im asuming its got something to do with internet explorer.??
Copy linkTweet thisAlerts:
@WebJoelNov 19.2006 — hey there,

thanks for the fast reply, got the border colour working, but by making it an img css it adds a border to all my images, but i just want this on the linked images? how do i link the css to one image but not another?

The other thing wasnt an underline

i havnt seen it before, but its just like an aqua blue square that apears around a link that ive just clicked on, but disapears when i click away from the link?

its not hapening in safari, so im asuming its got something to do with internet explorer.??[/QUOTE]


You could state in your STYLE section"

img {border:0 none;}

and if the [I]image[/I] is also a [I]link[/I], then this too;

[B]img a [/B]{border:0 none;}

The two statements above are not the same thing and are probably handled differently. I suppose that " [B]*[/B]img {border:0;} " would grab ALL images (using the 'universal selector' " [B]*[/B] ", -but I am not a fan of the 'star' method...

I might be mistaken (and I am sure someone will jump in here and correct me I am), that for "border" you can state either "0" ("zero"), "none", or both as I have done. There is some reason why using both is a hedge against possibly not being recognized and again, -I am sure that it's an IE thing...
Copy linkTweet thisAlerts:
@mooiNov 20.2006 — To apply it to just one image:

CSS:

img.img_class {

border: 1px solid #000000;

}

HTML:

<img class="img_class" src="" alt="" />
Copy linkTweet thisAlerts:
@disembodiedNov 20.2006 — Funk,

What these other two people said is pretty much on target, but I'll just sum up the method you want to use for borders around an image:

FOR ALL IMAGES, LINKED OR OTHERWISE (and with a border)

img {

border: 1px solid #000;

}

FOR ALL IMAGES, LINKED OR OTHERWISE (and no border no matter what)

img {

border: none;

}

(note* - I do not think '0 none' does anything more, I have never seen a problem with 'border: none', but I am not 100% positive)

FOR LINKED IMAGES ONLY, and ALL LINKED IMAGES

img a {

border: 1px solid #000;

}

(you can also used a.visited, a:hover, and a.active for when the link is in that specific state... if you do, make sure you do it it in that order (a, a.v, a:h, a.a) because IE is picky)

FOR A SPECIFIC IMAGE(s)

.imgborder {

border: 1px solid #000;

}

and then in the 'img src=blah blah' HTML include 'class="imgborder" (or whatever you decide to call it.


---------
As for the other problem you are having, I am still not sure of the specific problem, perhaps you could create the problem and post a screenshot?

Also, is it text or an image that is getting the border?
Copy linkTweet thisAlerts:
@WebJoelNov 20.2006 — ....FOR ALL IMAGES, LINKED OR OTHERWISE (and no border no matter what)

img {

border: none;

}

(note* - I do not think '0 none' does anything more, I have never seen a problem with 'border: none', but I am not 100% positive)

....[/QUOTE]

Actually, I have never seen it make any notable difference either, but thought it had something to do with a (much?) older version of a browser, or possibly a platform. ? It's just one of those 'nice to know' things like stating

[B]cursor: pointer; cursor: hand;[/B] whereby stating "pointer" targets compliant browsers, and "hand" targets specifically IE 5.x (which not only can't understand "pointer", but will fail if "pointer" comes [I]after[/I] "hand"... because "hand" is the IE-proprietary & expected declaration.

-I don't like IE... ?
Copy linkTweet thisAlerts:
@Jeff_MottNov 21.2006 — I am sure someone will jump in here and correct me[/quote]Sorry to be the stickler. I'm just trying to keep careless mistakes from creeping in.

and if the image is also a link, then this too;

img a {border:0 none;}[/quote]
The IMG element is empty; it will never contain any other element. Therefore, this selector will never select anything. Probably what you mean to do is [u]a img { border: none }[/u], which will select only those images that are also links.

I suppose that " *img {border:0;} " would grab ALL images (using the 'universal selector' " * ", -but I am not a fan of the 'star' method...[/quote]There is actually no difference between [u]img { border: none }[/u] and [u]* img { border: none }[/u]. The star in this case is redundant. Both will select all images.
×

Success!

Help @PRINCESS_FUNK spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...