This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Stylesheets > July 2007 > eliminating link borders with CSS?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
eliminating link borders with CSS?
|
|
|
| Is there an equivelant in CSS to border="0" for links? Or is it ok
even in strict XHTML to still use that attribute? I've tried using
a:link and setting the border to none and text decoration to none, but
still I get a border in both firefox and IE. I also tried setting
a.img as a class with the same above settings and giving that class to
the anchor link, but that still leaves the default blue border.
| |
|
| On 2007-07-13, alice <alice@fearofdolls.com> wrote:
> Is there an equivelant in CSS to border="0" for links? Or is it ok
> even in strict XHTML to still use that attribute? I've tried using
> a:link and setting the border to none and text decoration to none, but
> still I get a border in both firefox and IE. I also tried setting
> a.img as a class with the same above settings and giving that class to
> the anchor link, but that still leaves the default blue border.
The blue line underneath links isn't a border, it's a text-decoration:
underline. You can set text-decoration: none to make it go away, which
you say you tried, and it should have worked, and I don't understand why
it didn't.
| |
| Jukka K. Korpela 2007-07-13, 6:17 pm |
| Scripsit alice:
> Is there an equivelant in CSS to border="0" for links?
Surprisingly, yes: border: 0. Or alternatively: border: none. Whether it's a
good thing to remove the default borders from images that are links (which
is what this is about) is a different issue, and a more important one. It's
easy to check the technicalities. But it seems to be much more difficult to
understand that
a) Links Want To Be Links (and look like links, i.e. be _recognizable_ as
links)
b) Images Want To Be Images (and not links).
See http://www.cs.tut.fi/~jkorpela/www/links.html
> Or is it ok
> even in strict XHTML to still use that attribute?
That's an HTML issue, so it's basically off-topic, and you can easily check
out from the specifications that Strict XHTML, or Strict HTML 4.01, does not
allow the border attribute for img. What appears to be more difficult is the
fact that there's little point in using XHTML as the delivery format of web
pages - authors just confuse themselves (and sometimes browsers and
validators) trying to do that.
> I've tried using
> a:link and setting the border to none and text decoration to none, but
> still I get a border in both firefox and IE.
Well, you didn't specify a URL (naughty girl!) but you luckily gave
sufficient information: you were setting the border of <a> elements (namely
those that are unvisited links, in this case) to zero, but this has no
effect, since such elements have no default border. The default border
belongs to the img element, so you _could_ (if what you want were
reasonable) set
:link img, :visited img { border: 0; }
or, even simpler, just
img { border: 0; }
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
| |
| alice 2007-07-13, 10:18 pm |
| On Jul 13, 1:44 pm, "Jukka K. Korpela" <jkorp...@cs.tut.fi> wrote:
> Scripsit alice:
>
>
> Surprisingly, yes: border: 0. Or alternatively: border: none. Whether it's a
> good thing to remove the default borders from images that are links (which
> is what this is about) is a different issue, and a more important one. It's
> easy to check the technicalities. But it seems to be much more difficult to
> understand that
> a) Links Want To Be Links (and look like links, i.e. be _recognizable_ as
> links)
> b) Images Want To Be Images (and not links).
> Seehttp://www.cs.tut.fi/~jkorpela/www/links.html
>
>
> That's an HTML issue, so it's basically off-topic, and you can easily check
> out from the specifications that Strict XHTML, or Strict HTML 4.01, does not
> allow the border attribute for img. What appears to be more difficult is the
> fact that there's little point in using XHTML as the delivery format of web
> pages - authors just confuse themselves (and sometimes browsers and
> validators) trying to do that.
>
>
> Well, you didn't specify a URL (naughty girl!) but you luckily gave
> sufficient information: you were setting the border of <a> elements (namely
> those that are unvisited links, in this case) to zero, but this has no
> effect, since such elements have no default border. The default border
> belongs to the img element,
But the images did not have border until I made them links, so doesn't
that mean it is an element of the 'a'?
At any rate, I see that img {border: 0;} should probably work, and now
I don't know why I didn't think of that in the first place. I guess
I'm still new to using CSS.
so you _could_ (if what you want were
> reasonable) set
>
> :link img, :visited img { border: 0; }
>
> or, even simpler, just
>
> img { border: 0; }
>
> --
> Jukka K. Korpela ("Yucca")http://www.cs.tut.fi/~jkorpela/
| |
| Jukka K. Korpela 2007-07-14, 6:18 pm |
| Scripsit alice:
>
> But the images did not have border until I made them links, so doesn't
> that mean it is an element of the 'a'?
No. The border is still a border of the img element. You can see this
indirectly from the fact that using the attribute border="0" in an <img>
element removes the border. (Such an attribute has no effect for an <a>
element, and it is not even valid there.)
The point is that the default browser style sheet has something like
A:link IMG { border: 2px solid blue }
A:visited IMG { border: 2px solid magenta }
A:active IMG { border: 2px solid red }
That is, they set a border for <img> elements when they appear inside an <a>
element that is a link. The color varies by the link status, as does the
color of textual links.
Until you understand this idea, it's best to avoid messing around with
settings that break the idea. And when you understand the idea, you don't
_want_ to mess around. At most, you will tune the colors a bit, since the
default colors are too bright (too strong).
You didn't need to quote my entire message since you were only commenting on
one paragraph or lesss. Actually, it was illegal (violation of copyright) to
quote more than necessary. Please take a crash course on Usenet netiquette;
the following page may help:
http://www.cs.tut.fi/~jkorpela/usenet/dont.html
> I guess I'm still new to using CSS.
Yes. You actually indicated that by wanting to remove the border around
image links and by not being able to find out the techniques yourself. It's
one of the most common ways of going wrong at an early phase.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
| |
| dorayme 2007-07-14, 10:15 pm |
| In article <3T2mi.191526$wp7.181047@reader1.news.saunalahti.fi>,
"Jukka K. Korpela" <jkorpela@cs.tut.fi> wrote:
> You didn't need to quote my entire message since you were only commenting on
> one paragraph or lesss. Actually, it was illegal (violation of copyright) to
> quote more than necessary.
Now here is an opportunity for a bright energetic slight
variation in the career of an ambulance chasing lawyer (I can see
Danny De Vito in the role).
--
dorayme
| |
| David Stone 2007-07-16, 6:19 pm |
| In article
<doraymeRidThis-489D8B.09205815072007@news-vip.optusnet.com.au>,
dorayme <doraymeRidThis@optusnet.com.au> wrote:
> In article <3T2mi.191526$wp7.181047@reader1.news.saunalahti.fi>,
> "Jukka K. Korpela" <jkorpela@cs.tut.fi> wrote:
>
>
> Now here is an opportunity for a bright energetic slight
> variation in the career of an ambulance chasing lawyer (I can see
> Danny De Vito in the role).
Maybe, but probably not. I think you'd have a very hard time persuading
any judge that a reply to a letter, e-mail, or news post could be
considered as a 'creative work' under copyright law. Jukka was correct
to say that it wasn't necessary to reproduce his entire post, but calling
it illegal is a stretch (and not exactly kind, either!)
| |
| Andy Dingley 2007-07-16, 6:19 pm |
| On 16 Jul, 13:25, David Stone <no.em...@domain.invalid> wrote:
> Maybe, but probably not. I think you'd have a very hard time persuading
> any judge that a reply to a letter, e-mail, or news post could be
> considered as a 'creative work' under copyright law.
Of course it's a creative work!
> Jukka was correct
> to say that it wasn't necessary to reproduce his entire post, but calling
> it illegal is a stretch
Indeed, but that's due to the defence of "fair use", or alternately by
showing that posting to usenet is, by established convention, placing
such content into the public domain (unless (and only possibly)
annotated otherwise). The reason why it's farcical to equate failure
to trim with a breach of copyright isn't because the work is too
trivial for copyright law to apply.
| |
| dorayme 2007-07-17, 3:17 am |
| In article
<1184594756.268694.180980@n60g2000hse.googlegroups.com>,
Andy Dingley <dingbat@codesmiths.com> wrote:
> On 16 Jul, 13:25, David Stone <no.em...@domain.invalid> wrote:
>
>
> Of course it's a creative work!
>
>
> Indeed, but that's due to the defence of "fair use", or alternately by
> showing that posting to usenet is, by established convention, placing
> such content into the public domain (unless (and only possibly)
> annotated otherwise). The reason why it's farcical to equate failure
> to trim with a breach of copyright isn't because the work is too
> trivial for copyright law to apply.
I say let us test it. We should wait for someone in some nice
tropical part of the world to unnecessarily quote one of JK's
better pieces and organise to have the case heard there. We all
turn up and have a good time.
--
dorayme
| |
| Andy Dingley 2007-07-17, 6:17 am |
| On 17 Jul, 05:09, dorayme <doraymeRidT...@optusnet.com.au> wrote:
> I say let us test it. We should wait for someone in some nice
> tropical part of the world to unnecessarily quote one of JK's
> better pieces and organise to have the case heard there. We all
> turn up and have a good time.
Why should we need to travel? You're already in Oz and I'm only just
back from a couple of weeks in South Africa (on the coast - loved it).
| |
| dorayme 2007-07-17, 6:18 pm |
| In article
<1184662556.880806.251420@x35g2000prf.googlegroups.com>,
Andy Dingley <dingbat@codesmiths.com> wrote:
> On 17 Jul, 05:09, dorayme <doraymeRidT...@optusnet.com.au> wrote:
>
>
> Why should we need to travel? You're already in Oz and I'm only just
> back from a couple of weeks in South Africa (on the coast - loved it).
It is always greener on the other... hang on... it is always more
tropical and lush on the other side of... no, hang on... it is
always...
No, the truth, I must be quite frank. It's always better to
behave badly away from home.
--
dorayme
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|