473,670 Members | 2,405 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 81517
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
995
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 myEvent in events) { //Unwire the events
2
3221
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 a particular user (when the user places more than 1 order) can be viewed by clicking links. The...
1
1367
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
2773
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 language="javascript1.2">
0
8466
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8384
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8591
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8659
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7412
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6212
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4388
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2799
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
2
1791
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.