Use CSS to make a dummy link for javascript

When most people want to execute javascript from a piece of text they usually use the tag. But they dont want the link to go anywhere so they use a the number symbol # in the href attribute to specify that nothing happens when it’s clicked. That is what in some web applications you will notice the address bar contains a number symbol # at the end ie. portlandwebdev.com/here.php#. This is the improper use of the anchor functionality and if you have a page that scrolls vertically you will notice some unexpected scrolling or jumping when clicking on links that have number symbol # hrefs specified. Instead of trying to get a pointer using this buggy technique, just use css to force the cursor on mouseover.

  1.  
  2. .link:hover {
  3.       cursor:pointer;
  4. }
  5.  
  1.  
  2. <a class="link">link</a>
  3. <span class="link">link</span>
  4.  

Both of these elements will product the text “link” where the mouse pointer for links will appear.

Leave a Reply

watch free movies online download movies online free movies online