By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,676 Members | 1,763 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,676 IT Pros & Developers. It's quick & easy.

DYNAMICALLY disable links with CSS?

P: n/a
You have an, a, anchor with href link.

Can you use a stylesheet to effectively disable the link, so that you
can't click on it; that it will appear simply as text?
Jul 20 '05 #1
Share this Question
Share on Google+
32 Replies


P: n/a
Mark Johnson <10*******@compuserve.com> wrote:
You have an, a, anchor with href link.

Can you use a stylesheet to effectively disable the link, so that you
can't click on it; that it will appear simply as text?


No.
Why?

--
Spartanicus
Jul 20 '05 #2

P: n/a
Mark Johnson <10*******@compuserve.com> wrote:
You have an, a, anchor with href link.

Can you use a stylesheet to effectively disable the link, so that you
can't click on it; that it will appear simply as text?


No.
Why?

--
Spartanicus
Jul 20 '05 #3

P: n/a
Mark Johnson <10*******@compuserve.com> wrote:
You have an, a, anchor with href link.

Can you use a stylesheet to effectively disable the link, so that you
can't click on it;
No. If you don't want a link then don't include the link in the HTML.
that it will appear simply as text?


Sort of.
a:link, a:visited, a:hover {color: black; background: white;
text-decoration: none; cursor: default;}

Conceals it visually, but anyone tabbing through the links will still
see a focus rectangle around it (or their browser's equivalent).
Adding a:focus {-moz-outline: none;} will then remove this in Mozilla.
Opera supports outline, but uses a background colour change to
indicate focus on links and doesn't allow styles to remove that. For
IE you would need to use JavaScript to blur() the link.

But it's all a lot of effort for something that's much easier achieved
by simply not including the link in the first place.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #4

P: n/a
Mark Johnson <10*******@compuserve.com> wrote:
You have an, a, anchor with href link.

Can you use a stylesheet to effectively disable the link, so that you
can't click on it;
No. If you don't want a link then don't include the link in the HTML.
that it will appear simply as text?


Sort of.
a:link, a:visited, a:hover {color: black; background: white;
text-decoration: none; cursor: default;}

Conceals it visually, but anyone tabbing through the links will still
see a focus rectangle around it (or their browser's equivalent).
Adding a:focus {-moz-outline: none;} will then remove this in Mozilla.
Opera supports outline, but uses a background colour change to
indicate focus on links and doesn't allow styles to remove that. For
IE you would need to use JavaScript to blur() the link.

But it's all a lot of effort for something that's much easier achieved
by simply not including the link in the first place.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #5

P: n/a
Steve Pugh <st***@pugh.net> wrote:
Mark Johnson <10*******@compuserve.com> wrote:
You have an, a, anchor with href link. Can you use a stylesheet to effectively disable the link, so that you
can't click on it;

No. If you don't want a link then don't include the link in the HTML.


CSS is supposed to provide the layout, color, etc. I've got 'float'
columns, selective images, corners/'ears' for IE, and the rest which
make variations look like almost entirely different pages, including
background url() rollovers, but where those suggest some styles that
can move/tranfer the link over to that css rollover, and off/away from
the purely text link. So the link remains, in the href. And the text
still shows. But the text doesn't react to mouseover or click. Only
the associated button does, which shows up in particular styles,
showing different button glyphs. It would just be slicker to be able
to do that, turn off the text link. But it's no loss if one can't. In
other words, not a "display:none", but something like a "disable:true"
but applied to particular elements and events.
Jul 20 '05 #6

P: n/a
Steve Pugh <st***@pugh.net> wrote:
Mark Johnson <10*******@compuserve.com> wrote:
You have an, a, anchor with href link. Can you use a stylesheet to effectively disable the link, so that you
can't click on it;

No. If you don't want a link then don't include the link in the HTML.


CSS is supposed to provide the layout, color, etc. I've got 'float'
columns, selective images, corners/'ears' for IE, and the rest which
make variations look like almost entirely different pages, including
background url() rollovers, but where those suggest some styles that
can move/tranfer the link over to that css rollover, and off/away from
the purely text link. So the link remains, in the href. And the text
still shows. But the text doesn't react to mouseover or click. Only
the associated button does, which shows up in particular styles,
showing different button glyphs. It would just be slicker to be able
to do that, turn off the text link. But it's no loss if one can't. In
other words, not a "display:none", but something like a "disable:true"
but applied to particular elements and events.
Jul 20 '05 #7

P: n/a

"Spartanicus" <me@privacy.net> schreef in bericht
news:ah********************************@news.spart anicus.utvinternet.ie...
Mark Johnson <10*******@compuserve.com> wrote:
You have an, a, anchor with href link.

Can you use a stylesheet to effectively disable the link, so that you
can't click on it; that it will appear simply as text?


No.
Why?
--
Spartanicus


I could think of a reason.
Suppose you want a secret link, a link you don't want strangers to use,
but for friends or relatives it's OK.

You tell your friends where it is so they can use it. (off course you don't
mind too much if
somebody else stumbles on it or else you shoudn't be doing this)

Jakob
Jul 20 '05 #8

P: n/a

"Spartanicus" <me@privacy.net> schreef in bericht
news:ah********************************@news.spart anicus.utvinternet.ie...
Mark Johnson <10*******@compuserve.com> wrote:
You have an, a, anchor with href link.

Can you use a stylesheet to effectively disable the link, so that you
can't click on it; that it will appear simply as text?


No.
Why?
--
Spartanicus


I could think of a reason.
Suppose you want a secret link, a link you don't want strangers to use,
but for friends or relatives it's OK.

You tell your friends where it is so they can use it. (off course you don't
mind too much if
somebody else stumbles on it or else you shoudn't be doing this)

Jakob
Jul 20 '05 #9

P: n/a
Mark Johnson <10*******@compuserve.com> wrote:
Steve Pugh <st***@pugh.net> wrote:
Mark Johnson <10*******@compuserve.com> wrote:
You have an, a, anchor with href link.Can you use a stylesheet to effectively disable the link, so that you
can't click on it;

No. If you don't want a link then don't include the link in the HTML.


CSS is supposed to provide the layout, color, etc.


Yes, not fdunctionality. Disabling a link is functionality.
I've got 'float'
columns, selective images, corners/'ears' for IE, and the rest which
make variations look like almost entirely different pages, including
background url() rollovers, but where those suggest some styles that
can move/tranfer the link over to that css rollover, and off/away from
the purely text link.
Hang on. You have <a href="">text</a> and you've styled it so that it
has a changing background on :hover, right?

Because I don't see how you can "transfer" the link to another
element. Nothing in HTML or CSS can make the link apply to the iamge
and not the text if the img is not part of the <a> element:
<a href="">text</a> <img>
So the link remains, in the href.
Yes, otherwise there is no link.
And the text still shows.
Yes. Unless you hide it in some way, is that what you want to do?
But the text doesn't react to mouseover or click.
I though this is what you were asking how to do? If it's already doing
it then what was your question?
Only
the associated button does, which shows up in particular styles,
showing different button glyphs.
The "button" is a background image added to the <a> element isn't it?
It would just be slicker to be able
to do that, turn off the text link.
If you turn off the link then there is no link.

You have to think about the <a> element and its content text
separately. If you "turn off" the <a> element then there is no link at
all, no matter what other styles you've added.
But it's no loss if one can't. In
other words, not a "display:none", but something like a "disable:true"
but applied to particular elements and events.


If you want to hide the text but keep the link then you can do
something like this:

<a href=""><span>text></span></a>

a span { display: none}
Hides the link but keeps the <a> element (set display: block; width:
XX; height: YY; so that the link covers the whole of the background
image, otherwise the <a> will have zero size when its contents have
been removed).

Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #10

P: n/a
"Jakob" <ac******@hotmail.com> wrote:
"Spartanicus" <me@privacy.net> schreef in bericht
news:ah********************************@news.spar tanicus.utvinternet.ie...
Mark Johnson <10*******@compuserve.com> wrote:
>You have an, a, anchor with href link.
>
>Can you use a stylesheet to effectively disable the link, so that you
>can't click on it; that it will appear simply as text?
No.
Why?


I could think of a reason.
Suppose you want a secret link, a link you don't want strangers to use,
but for friends or relatives it's OK.


And presumably okay for search engines to follow and index the page
afterwards as well?
You tell your friends where it is so they can use it. (off course you don't
mind too much if somebody else stumbles on it or else you shoudn't be doing this)


Exactly, much easier to tell your friends the URL of the following
page and not include a link at all.

This sort of 'hidden' link is old hat - I remember people using it
back in 1995 with linked transparent gifs.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #11

P: n/a
Mark Johnson <10*******@compuserve.com> wrote:
Steve Pugh <st***@pugh.net> wrote:
Mark Johnson <10*******@compuserve.com> wrote:
You have an, a, anchor with href link.Can you use a stylesheet to effectively disable the link, so that you
can't click on it;

No. If you don't want a link then don't include the link in the HTML.


CSS is supposed to provide the layout, color, etc.


Yes, not fdunctionality. Disabling a link is functionality.
I've got 'float'
columns, selective images, corners/'ears' for IE, and the rest which
make variations look like almost entirely different pages, including
background url() rollovers, but where those suggest some styles that
can move/tranfer the link over to that css rollover, and off/away from
the purely text link.
Hang on. You have <a href="">text</a> and you've styled it so that it
has a changing background on :hover, right?

Because I don't see how you can "transfer" the link to another
element. Nothing in HTML or CSS can make the link apply to the iamge
and not the text if the img is not part of the <a> element:
<a href="">text</a> <img>
So the link remains, in the href.
Yes, otherwise there is no link.
And the text still shows.
Yes. Unless you hide it in some way, is that what you want to do?
But the text doesn't react to mouseover or click.
I though this is what you were asking how to do? If it's already doing
it then what was your question?
Only
the associated button does, which shows up in particular styles,
showing different button glyphs.
The "button" is a background image added to the <a> element isn't it?
It would just be slicker to be able
to do that, turn off the text link.
If you turn off the link then there is no link.

You have to think about the <a> element and its content text
separately. If you "turn off" the <a> element then there is no link at
all, no matter what other styles you've added.
But it's no loss if one can't. In
other words, not a "display:none", but something like a "disable:true"
but applied to particular elements and events.


If you want to hide the text but keep the link then you can do
something like this:

<a href=""><span>text></span></a>

a span { display: none}
Hides the link but keeps the <a> element (set display: block; width:
XX; height: YY; so that the link covers the whole of the background
image, otherwise the <a> will have zero size when its contents have
been removed).

Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #12

P: n/a
"Jakob" <ac******@hotmail.com> wrote:
"Spartanicus" <me@privacy.net> schreef in bericht
news:ah********************************@news.spar tanicus.utvinternet.ie...
Mark Johnson <10*******@compuserve.com> wrote:
>You have an, a, anchor with href link.
>
>Can you use a stylesheet to effectively disable the link, so that you
>can't click on it; that it will appear simply as text?
No.
Why?


I could think of a reason.
Suppose you want a secret link, a link you don't want strangers to use,
but for friends or relatives it's OK.


And presumably okay for search engines to follow and index the page
afterwards as well?
You tell your friends where it is so they can use it. (off course you don't
mind too much if somebody else stumbles on it or else you shoudn't be doing this)


Exactly, much easier to tell your friends the URL of the following
page and not include a link at all.

This sort of 'hidden' link is old hat - I remember people using it
back in 1995 with linked transparent gifs.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #13

P: n/a
Steve Pugh <st***@pugh.net> wrote:
Hang on. You have <a href="">text</a> and you've styled it so that it
has a changing background on :hover, right?
No. It just stays as text. But a couple of nested divisions before it,
just float to the left, and can contain a button and hover-button,
separately, for a single anchor tag which duplicates the href link.
Some of my styles don't do that. Typically it's display:none. But one
does. It's a very different look than the others. So I wanted to
transfer the click, the link, over to the button, and away from the
text. The text remains. But it doesn't do anything. And I don't know
how to do that.

It would just be slicker to be able
to do that, turn off the text link.

If you turn off the link then there is no link.
Exactly.

If you want to hide the text


I want the text to remain visible, to identify the button's link.

Maybe it just can't be done. Again, it would be nicer. But it's no
loss.

Jul 20 '05 #14

P: n/a
Steve Pugh <st***@pugh.net> wrote:
Hang on. You have <a href="">text</a> and you've styled it so that it
has a changing background on :hover, right?
No. It just stays as text. But a couple of nested divisions before it,
just float to the left, and can contain a button and hover-button,
separately, for a single anchor tag which duplicates the href link.
Some of my styles don't do that. Typically it's display:none. But one
does. It's a very different look than the others. So I wanted to
transfer the click, the link, over to the button, and away from the
text. The text remains. But it doesn't do anything. And I don't know
how to do that.

It would just be slicker to be able
to do that, turn off the text link.

If you turn off the link then there is no link.
Exactly.

If you want to hide the text


I want the text to remain visible, to identify the button's link.

Maybe it just can't be done. Again, it would be nicer. But it's no
loss.

Jul 20 '05 #15

P: n/a
Mark Johnson <10*******@compuserve.com> wrote:
Steve Pugh <st***@pugh.net> wrote:
Hang on. You have <a href="">text</a> and you've styled it so that it
has a changing background on :hover, right?
No. It just stays as text. But a couple of nested divisions before it,
just float to the left, and can contain a button and hover-button,
separately, for a single anchor tag which duplicates the href link.


So you actually have two links to the same resource?
Some of my styles don't do that Typically it's display:none.
But one does. It's a very different look than the others.
Yes, different styles produce different looks. You have two links to
the same resource styled differently and you don't want one of them to
be a link? So remove the <a> element from the second one.
So I wanted to
transfer the click, the link, over to the button, and away from the
text.
It's impossible (well except by changing the document with JavaScript)
to 'transfer' a link or anything like that. You seem to be implying
that you've managed to do this 'transferring' somehow. Telling us how
would maybe give us some indication of what on earth you're actually
taking about.
The text remains. But it doesn't do anything. And I don't know
how to do that.
<a href=""><img src="your button" alt=""></a>
the text.

What could be simpler?
It would just be slicker to be able
to do that, turn off the text link.
If you turn off the link then there is no link.


Exactly.


Do you want the link to exist or not? I'm very confused.
If you want to hide the text


I want the text to remain visible, to identify the button's link.


Identify it how?
Maybe it just can't be done. Again, it would be nicer. But it's no
loss.


I have no idea what you're actually trying to do. A URL normally
helps.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #16

P: n/a
Mark Johnson <10*******@compuserve.com> wrote:
Steve Pugh <st***@pugh.net> wrote:
Hang on. You have <a href="">text</a> and you've styled it so that it
has a changing background on :hover, right?
No. It just stays as text. But a couple of nested divisions before it,
just float to the left, and can contain a button and hover-button,
separately, for a single anchor tag which duplicates the href link.


So you actually have two links to the same resource?
Some of my styles don't do that Typically it's display:none.
But one does. It's a very different look than the others.
Yes, different styles produce different looks. You have two links to
the same resource styled differently and you don't want one of them to
be a link? So remove the <a> element from the second one.
So I wanted to
transfer the click, the link, over to the button, and away from the
text.
It's impossible (well except by changing the document with JavaScript)
to 'transfer' a link or anything like that. You seem to be implying
that you've managed to do this 'transferring' somehow. Telling us how
would maybe give us some indication of what on earth you're actually
taking about.
The text remains. But it doesn't do anything. And I don't know
how to do that.
<a href=""><img src="your button" alt=""></a>
the text.

What could be simpler?
It would just be slicker to be able
to do that, turn off the text link.
If you turn off the link then there is no link.


Exactly.


Do you want the link to exist or not? I'm very confused.
If you want to hide the text


I want the text to remain visible, to identify the button's link.


Identify it how?
Maybe it just can't be done. Again, it would be nicer. But it's no
loss.


I have no idea what you're actually trying to do. A URL normally
helps.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #17

P: n/a
Steve Pugh <st***@pugh.net> wrote:
I have no idea what you're actually trying to do. A URL normally
helps.


I just got the domain name, last week. I've got nothing on the site,
as yet. I'm working to get the first version ready.

But again, I have a text anchor, with URL, of course. And I have
couple of DIVs, one of which duplicates the link, but both of which
are typically not shown. They are placeholders, as with a number of
other SPANs and DIVs on each page. Some styles use these. Others turn
them off or ignore them. I have one style, among various, that uses
buttons loaded as background images, as an alternative method for an
image swap rollover, using only style sheets, and not javascript. But
since in that style a button is used, is shown, I thought it redundant
to also retain the anchor, the link, for the text, which is still
shown. I wanted it simply to be treated as text, even though it is
marked up with an anchor tag in the XHTML.

Again, I could imagine a javascript work around, at the time the style
is changed. These are selected from a dropdown box, and updated when
the window is resized, in javascript. Part of that could also involve
modifying certain links. But it would be too much of a kludge, I
think. Then again, my use of containers for box corners/ears is a bit
much if only IE would recognize corner-radius (on the other hand, it's
more flexible if you don't simply want a pure radius every time).

Anyway.

Jul 20 '05 #18

P: n/a
Steve Pugh <st***@pugh.net> wrote:
I have no idea what you're actually trying to do. A URL normally
helps.


I just got the domain name, last week. I've got nothing on the site,
as yet. I'm working to get the first version ready.

But again, I have a text anchor, with URL, of course. And I have
couple of DIVs, one of which duplicates the link, but both of which
are typically not shown. They are placeholders, as with a number of
other SPANs and DIVs on each page. Some styles use these. Others turn
them off or ignore them. I have one style, among various, that uses
buttons loaded as background images, as an alternative method for an
image swap rollover, using only style sheets, and not javascript. But
since in that style a button is used, is shown, I thought it redundant
to also retain the anchor, the link, for the text, which is still
shown. I wanted it simply to be treated as text, even though it is
marked up with an anchor tag in the XHTML.

Again, I could imagine a javascript work around, at the time the style
is changed. These are selected from a dropdown box, and updated when
the window is resized, in javascript. Part of that could also involve
modifying certain links. But it would be too much of a kludge, I
think. Then again, my use of containers for box corners/ears is a bit
much if only IE would recognize corner-radius (on the other hand, it's
more flexible if you don't simply want a pure radius every time).

Anyway.

Jul 20 '05 #19

P: n/a
Mark Johnson <10*******@compuserve.com> wrote:
But again, I have a text anchor, with URL, of course. And I have
couple of DIVs, one of which duplicates the link, but both of which
are typically not shown. They are placeholders, as with a number of
other SPANs and DIVs on each page. Some styles use these. Others turn
them off or ignore them. I have one style, among various, that uses
buttons loaded as background images, as an alternative method for an
image swap rollover, using only style sheets, and not javascript. But
since in that style a button is used, is shown, I thought it redundant
to also retain the anchor, the link, for the text, which is still
shown. I wanted it simply to be treated as text, even though it is
marked up with an anchor tag in the XHTML.


You know, I wonder if rather than thinking of modifying event
behavior, or rerouting it, that stylesheets could be used to hide a
portion of an anchor, but not the rest? That is - hide the anchor, and
so the behavior, but retain display of the text?

Jul 20 '05 #20

P: n/a
Mark Johnson <10*******@compuserve.com> wrote:
But again, I have a text anchor, with URL, of course. And I have
couple of DIVs, one of which duplicates the link, but both of which
are typically not shown. They are placeholders, as with a number of
other SPANs and DIVs on each page. Some styles use these. Others turn
them off or ignore them. I have one style, among various, that uses
buttons loaded as background images, as an alternative method for an
image swap rollover, using only style sheets, and not javascript. But
since in that style a button is used, is shown, I thought it redundant
to also retain the anchor, the link, for the text, which is still
shown. I wanted it simply to be treated as text, even though it is
marked up with an anchor tag in the XHTML.


You know, I wonder if rather than thinking of modifying event
behavior, or rerouting it, that stylesheets could be used to hide a
portion of an anchor, but not the rest? That is - hide the anchor, and
so the behavior, but retain display of the text?

Jul 20 '05 #21

P: n/a
Mark Johnson <10*******@compuserve.com> wrote:
Steve Pugh <st***@pugh.net> wrote:
I have no idea what you're actually trying to do. A URL normally
helps.
I just got the domain name, last week. I've got nothing on the site,
as yet. I'm working to get the first version ready.


If it was finished we wouldn't need to see it, would we? Stick it on
free web space if you haven't purchased hosting yet.
But again, I have a text anchor, with URL, of course.
<a href="foo">text</a>
And I have couple of DIVs,
<div>...</div>
<div>...</div>
one of which duplicates the link,
Duplicated it how? By containing a _second_ <a href="foo"></a> ?
but both of which are typically not shown.
display: none; or visibility: hidden; ?
They are placeholders, as with a number of other SPANs and DIVs on each page.
Some styles use these. Others turn them off or ignore them.
You page has multiple style sheets?
I have one style, among various, that uses
buttons loaded as background images, as an alternative method for an
image swap rollover, using only style sheets, and not javascript.
As IE does not support :hover except on <a> elements this very
strongly implies that the "buttons" are duplicate <a href="foo"></a>
elements.
But
since in that style a button is used, is shown, I thought it redundant
to also retain the anchor, the link, for the text, which is still
shown.
In general it is poor usability to have multiple links to the same
resource, but it's not an absolute rule. The important point is to
make sure that the user knows that the links are the same - so make
sure that both your text links and "buttons" have clear :visited
styles so that users aren't fooled into following links that they've
already visited.
I wanted it simply to be treated as text, even though it is
marked up with an anchor tag in the XHTML.


I gave some styles in my first post that hide the appearance of being
a link. Did you try them?

There is no way in CSS to remove the link from an <a> element without
removing the whole element.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #22

P: n/a
Mark Johnson <10*******@compuserve.com> wrote:
You know, I wonder if rather than thinking of modifying event
behavior, or rerouting it, that stylesheets could be used to hide a
portion of an anchor, but not the rest? That is - hide the anchor, and
so the behavior, but retain display of the text?


No. The link is a property of the whole <a> element not just part of
it. With JavaScript you can strip out the tags converting the <a>
element into a text node, or remove the href attribute node converting
it into a link-less <a> element. But with CSS all you can do is change
the presentation of the element.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #23

P: n/a
Mark Johnson <10*******@compuserve.com> wrote:
Steve Pugh <st***@pugh.net> wrote:
I have no idea what you're actually trying to do. A URL normally
helps.
I just got the domain name, last week. I've got nothing on the site,
as yet. I'm working to get the first version ready.


If it was finished we wouldn't need to see it, would we? Stick it on
free web space if you haven't purchased hosting yet.
But again, I have a text anchor, with URL, of course.
<a href="foo">text</a>
And I have couple of DIVs,
<div>...</div>
<div>...</div>
one of which duplicates the link,
Duplicated it how? By containing a _second_ <a href="foo"></a> ?
but both of which are typically not shown.
display: none; or visibility: hidden; ?
They are placeholders, as with a number of other SPANs and DIVs on each page.
Some styles use these. Others turn them off or ignore them.
You page has multiple style sheets?
I have one style, among various, that uses
buttons loaded as background images, as an alternative method for an
image swap rollover, using only style sheets, and not javascript.
As IE does not support :hover except on <a> elements this very
strongly implies that the "buttons" are duplicate <a href="foo"></a>
elements.
But
since in that style a button is used, is shown, I thought it redundant
to also retain the anchor, the link, for the text, which is still
shown.
In general it is poor usability to have multiple links to the same
resource, but it's not an absolute rule. The important point is to
make sure that the user knows that the links are the same - so make
sure that both your text links and "buttons" have clear :visited
styles so that users aren't fooled into following links that they've
already visited.
I wanted it simply to be treated as text, even though it is
marked up with an anchor tag in the XHTML.


I gave some styles in my first post that hide the appearance of being
a link. Did you try them?

There is no way in CSS to remove the link from an <a> element without
removing the whole element.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #24

P: n/a
Mark Johnson <10*******@compuserve.com> wrote:
You know, I wonder if rather than thinking of modifying event
behavior, or rerouting it, that stylesheets could be used to hide a
portion of an anchor, but not the rest? That is - hide the anchor, and
so the behavior, but retain display of the text?


No. The link is a property of the whole <a> element not just part of
it. With JavaScript you can strip out the tags converting the <a>
element into a text node, or remove the href attribute node converting
it into a link-less <a> element. But with CSS all you can do is change
the presentation of the element.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #25

P: n/a
Jakob wrote:

I could think of a reason.
Suppose you want a secret link, a link you don't want strangers to use,
but for friends or relatives it's OK.


Set up authentication for it and give your friends and relatives the URL
and the password.

'Later
Peter

--
Peter aka Ulujain - Computing for Fun!
http://www.ulujain.org/
Jul 20 '05 #26

P: n/a
Jakob wrote:

I could think of a reason.
Suppose you want a secret link, a link you don't want strangers to use,
but for friends or relatives it's OK.


Set up authentication for it and give your friends and relatives the URL
and the password.

'Later
Peter

--
Peter aka Ulujain - Computing for Fun!
http://www.ulujain.org/
Jul 20 '05 #27

P: n/a
Steve Pugh <st***@pugh.net> wrote:
Mark Johnson <10*******@compuserve.com> wrote:
I wanted it simply to be treated as text, even though it is
marked up with an anchor tag in the XHTML.


There is no way in CSS to remove the link from an <a> element without
removing the whole element.


To disable a link using only CSS, no JavaScript, position a
transparent element over the link text and give it a higher z-index so
it is "in front of" the link text.

This newsgroup often has messages from people who have accidentally
disabled links while experimenting with absolute positioning.

--
Karl Smith.
Jul 20 '05 #28

P: n/a
Steve Pugh <st***@pugh.net> wrote:
Mark Johnson <10*******@compuserve.com> wrote:
I wanted it simply to be treated as text, even though it is
marked up with an anchor tag in the XHTML.


There is no way in CSS to remove the link from an <a> element without
removing the whole element.


To disable a link using only CSS, no JavaScript, position a
transparent element over the link text and give it a higher z-index so
it is "in front of" the link text.

This newsgroup often has messages from people who have accidentally
disabled links while experimenting with absolute positioning.

--
Karl Smith.
Jul 20 '05 #29

P: n/a
go************@kjsmith.com (Karl Smith) wrote:
Steve Pugh <st***@pugh.net> wrote:
Mark Johnson <10*******@compuserve.com> wrote:
>I wanted it simply to be treated as text, even though it is
>marked up with an anchor tag in the XHTML.


There is no way in CSS to remove the link from an <a> element without
removing the whole element.


To disable a link using only CSS, no JavaScript, position a
transparent element over the link text and give it a higher z-index so
it is "in front of" the link text.


Does that also disable the link if the user is navigating with the
keyboard rather than the mouse?

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #30

P: n/a
go************@kjsmith.com (Karl Smith) wrote:
Steve Pugh <st***@pugh.net> wrote:
Mark Johnson <10*******@compuserve.com> wrote:
>I wanted it simply to be treated as text, even though it is
>marked up with an anchor tag in the XHTML.


There is no way in CSS to remove the link from an <a> element without
removing the whole element.


To disable a link using only CSS, no JavaScript, position a
transparent element over the link text and give it a higher z-index so
it is "in front of" the link text.


Does that also disable the link if the user is navigating with the
keyboard rather than the mouse?

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #31

P: n/a
Steve Pugh <st***@pugh.net> wrote in message news:
go************@kjsmith.com (Karl Smith) wrote:
Steve Pugh <st***@pugh.net> wrote:
Mark Johnson <10*******@compuserve.com> wrote:

>I wanted it simply to be treated as text, even though it is
>marked up with an anchor tag in the XHTML.

There is no way in CSS to remove the link from an <a> element without
removing the whole element.


To disable a link using only CSS, no JavaScript, position a
transparent element over the link text and give it a higher z-index so
it is "in front of" the link text.


Does that also disable the link if the user is navigating with the
keyboard rather than the mouse?


I doubt it, but I've never figured out keyboard controls. I wasn't
really disagreeing with aything you've written here, it's just my
(accurate, I believe) response to the OP's original query:

"You have an, a, anchor with href link. Can you use a stylesheet to
effectively disable the link, so that you can't click on it; that it
will appear simply as text?"

But the original question seems to have developed into a moving target
since then.

--
Karl Smith.
Jul 20 '05 #32

P: n/a
Steve Pugh <st***@pugh.net> wrote in message news:
go************@kjsmith.com (Karl Smith) wrote:
Steve Pugh <st***@pugh.net> wrote:
Mark Johnson <10*******@compuserve.com> wrote:

>I wanted it simply to be treated as text, even though it is
>marked up with an anchor tag in the XHTML.

There is no way in CSS to remove the link from an <a> element without
removing the whole element.


To disable a link using only CSS, no JavaScript, position a
transparent element over the link text and give it a higher z-index so
it is "in front of" the link text.


Does that also disable the link if the user is navigating with the
keyboard rather than the mouse?


I doubt it, but I've never figured out keyboard controls. I wasn't
really disagreeing with aything you've written here, it's just my
(accurate, I believe) response to the OP's original query:

"You have an, a, anchor with href link. Can you use a stylesheet to
effectively disable the link, so that you can't click on it; that it
will appear simply as text?"

But the original question seems to have developed into a moving target
since then.

--
Karl Smith.
Jul 20 '05 #33

This discussion thread is closed

Replies have been disabled for this discussion.