Links, buttons and wraps


#1

When I make a link button or wrap an image with a href, I can only select the web address by using the left mouse button.

is there a way to have it so that when the right mouse button is clicked on the button/image it will take me directly to the URL

"<head>
	<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
	<title>About Me</title>
</head>
<body>
	<img src="https://s3.amazonaws.com/codecademy-blog/assets/46838757.png"/>
	<p>We're Codecademy! We're here to help you learn to code.</p><br/><br/>
	<div>
		<a href="http://cargocollective.com/simsdesign">Sims Industrial Design</a>
	</div>"

#2

Do you mean when you left-click the link you're not being taken to the url?

It's not conventional to use a right-click to follow a link. Most browsers will open a context menu when you right-click on a link, and from that context menu you'll be able to do things like open the link in a new tab, copy the link, etc.

It's not a good idea to override this default behavior unless you have a very good reason to, and anyway I don't think it's possible to do with just HTML and CSS.

I don't see any buttons or images wrapped with a link in your code, I only see a plain link <a href="http://cargocollective.com/simsdesign">Sims Industrial Design</a> . Is that the link you're having a problem with?


#3

Sorry I got L/R confused when writing my question. when I select the link with the right mouse button I get the option of opening the URL.

My question was is it possible, to select the link by just using the left mouse button (and the same for images that have a wrap)?

You mentioned that you do not think that it is possible with HTML/CSS if so what language?

P.S I was just supplying the code as an example of how I normally write it, my q was in general.

Thanks.


#4

@koda82,

I thing @katlandreth is pointing at jQuery....
If you load the jQuery environment via <script></script> tag within your <head></head> tag
you would have loaded a whole bunch of faciltiies like
https://api.jquery.com/mousedown/

The course about jQuery requires you to have some ex[erience with Javascript


#5

I'm not sure what you mean by

What do you mean by "select" in this case? Just clicking on it? Or are you trying to copy it or something?

I'm just going to guess that you either want to

A left-click the link and be taken to the URL (the default behavior) or

B you want to left-click the link to copy the link's URL so you can paste it somewhere else

Just to sum up:

  1. The link you posted works correctly. If you want left-click to take you to the URL of the link, and this link doesn't work for you, there must be a problem somewhere with your setup.
  2. If you're trying to make the left-click action do something other than the default, that's not usually a good idea. Anyone clicking the link who doesn't know you changed the default action might be confused, frustrated, or think the link is broken.
  3. If you do have a good reason to change the left-click behavior for your website, as @leonhard.wettengmx.n said, you could do it with JQuery, and actually probably with vanilla JavaScript. These are more advanced than HTML and CSS.

Last thing, if you want left-click to copy the link's URL - and this is just a behavior you want, for your own use - there are browser plugins that will add a "left-click to copy link location" action to your computer. It won't make left-click work differently for anyone else so no one will be confused about why links don't take them to a URL. Do a search for "left-click copy link location" to find some of these plugins.


#6

I need help with drawing the button i'm stuck on the part with the div and the height,width,border colors and the background color plz help me i'm in 5 grade:cry::(:frowning: ;(


#7

To left click the mouse.


#8

@cloudninja45435,
You will have to look for solutions in
== discussions / opinions ==
http://stackoverflow.com/questions/22581345/click-button-copy-to-clipboard-using-jquery
http://stackoverflow.com/questions/27799656/autohotkey-copy-link-text-on-click-to-clipboard
or other articles
google search
copy a link left click the mouse site:stackoverflow.com


#9

hi
how can we call function and its sub function