简体   繁体   中英

Can I turn off a link in CSS, e.g. for a bookmarklet install page?

I know how to use CSS to turn off or change the appearance of links on a web page (ie the anchor tags) but I'd like to turn them off completely. I'd like to do this for a bookmarklet install page. For example the Delicious tools page has a bookmarklet you can drag onto your browser's favourites bar. But on the install page because the bookmarklet is inevitably a link you can also accidentally click on it if you meant to drag it. This could confuse novices so I'd like to turn off the link behaviour in CSS whilst leaving the HTML intact as it is needed for the bookmarklet to work.

I doubt this is possible as it is a behavioural change not a formatting change, but it would be great if it is possible?

This is not possible with plain CSS.

However, you could prevent the browser from following the link by using javascript/jquery:

$("a.bookmarklet").click(function(e){
   e.preventDefault();
});

-- SEE DEMO --

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM