Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8295433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:35:13+00:00 2026-06-08T14:35:13+00:00

I decided to try to create a tabbed menu using just CSS and HTML.

  • 0

I decided to try to create a tabbed menu using just CSS and HTML. Using the :target pseudo-class to show the appropriate div, I’ve implemented it, only it jumps around a bit too much to be user friendly:

http://brad.sebdengroup.com/newodynsite/stockman.php#StockControl

Is there anyway I can fix this? Initially, I wanted to stay away from JavaScript, but I will happily add some if it fixes this.

Note: I know I can rebuild a new tabbed menu using jQuery/some fancy library but if possible, I’d rather fix this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T14:35:14+00:00Added an answer on June 8, 2026 at 2:35 pm

    Its because your using a hash value in your anchors. These cause it to jump to a div with the id specified by the hash.

    To sort this you can use jQuery to stop the jumping by using .preventDefault();

    You would use this by giving every anchor that jumps a class of prevent and then using jQuery to stop the jumping. Of course, you can change this selector dependant upon your html structure.

    $(".prevent").click(function(e) { //Note the e for event
      e.preventDefault();
    });
    

    Edit without jQuery

    After cursing not having jQuery to work with I have attempted to put together a pure js solution. You will need to check this to make sure it works on your page.

    Here is the jsfiddle example.

    What I have done is found all anchors on the page and then added return false into their onclick attribute. If this was to go on your live site you will need to further select the anchors, see this example and explanation:

    I have also added a class to anchors you do not want to jump. To use this you will need to add a class of “menuControl” to any anchor you want to stop jumping.

    Below is my JavaScript incase the jsfiddle link is broken. Just to mention but you will need to control the navigation of these tabs using JavaScript now, as using return false will stop the navigation.

    var anchors = document.getElementsByTagName("a");
    
    for(var i = 0; i < anchors.length; i++) {
        if ( anchors[i].className == "menuControl" ) {
            anchors[i].setAttribute("onclick", "return false");
        }
    } ​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had my game working and then decided to try and implement a menu
I am creating my first plugin and decided to try and create a mask
Today I decided to try to use CALayers to show a rectangular box overlaying
[SOLVED] So I decided to try and create a sorted doubly linked skip list...
I've decided to try and create a game before I finish studies. Searching around
I decided to try to my hand at this, and have had a somewhat
Having decided to try AForge for video and imaging stuff, I tried to implement
i am new to scrapy and decided to try it out because of good
A few days ago I installed tomcat 7 and decided to try building a
I'm pretty new to PHP, but I decided to try and make a simple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.