473,545 Members | 957 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DYNAMICALLY disable links with CSS?

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
32 81482
Mark Johnson <10*******@comp userve.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
Mark Johnson <10*******@comp userve.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
Mark Johnson <10*******@comp userve.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
Mark Johnson <10*******@comp userve.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
Steve Pugh <st***@pugh.net > wrote:
Mark Johnson <10*******@comp userve.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:no ne", but something like a "disable:tr ue"
but applied to particular elements and events.
Jul 20 '05 #6
Steve Pugh <st***@pugh.net > wrote:
Mark Johnson <10*******@comp userve.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:no ne", but something like a "disable:tr ue"
but applied to particular elements and events.
Jul 20 '05 #7

"Spartanicu s" <me@privacy.net > schreef in bericht
news:ah******** *************** *********@news. spartanicus.utv internet.ie...
Mark Johnson <10*******@comp userve.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

"Spartanicu s" <me@privacy.net > schreef in bericht
news:ah******** *************** *********@news. spartanicus.utv internet.ie...
Mark Johnson <10*******@comp userve.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
Mark Johnson <10*******@comp userve.com> wrote:
Steve Pugh <st***@pugh.net > wrote:
Mark Johnson <10*******@comp userve.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:no ne", but something like a "disable:tr ue"
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>t ext></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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
987
by: joe mamma | last post by:
I know it works for basic widows form components. . . Similar approach can be applied for other controls if this doesn't work . . . Typical Usage: ============================= ArrayList eventData = new ArrayList(); EventDescriptorCollection events = TypeDescriptor.GetEvents(myComponent); foreach (System.ComponentModel.EventDescriptor...
2
3214
by: rn5a | last post by:
In a shopping cart app, assume that a user has placed 4 orders (each order has a corresponding OrderID which will be unique). When he comes to MyCart.aspx, by default, the details of his last order he had placed will be displayed in a DataList. Also assume that the OrderID of the last order is 13. The details of the earlier orders placed by...
1
1364
by: Howard Vaflor | last post by:
Please give me an idea/code on how I can disable links which redirect to other pages. I need the user to check an "agree" checkbox before they can click on the links. Thanks guys
22
2756
matheussousuke
by: matheussousuke | last post by:
I currently found a script that dynamically loads an ASX playlist, allowing the user to choose the item that he wants to watch in Windows media player embedded. The trouble is that once the user click on the link in the playlist it wont work. Take a look here http://tv.mghospedagem.com/wmp-pl3.html Works only on IE. <head> <script...
0
7456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7649
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7802
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7744
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5960
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3442
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1869
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1010
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
692
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.