CSS - The Failure of Implementing Multiple Segmented Controls

Recently, I came across a fantastic segmented control on and I am looking to customize it to fit my requirements.

However, I encountered an issue where adding multiple controls to the page only affects the first segmented control. Instead of duplicating the CSS and naming multiple times, I was wondering if there is another way to solve this problem, perhaps by utilizing jQuery?

For reference, here is the code in a JSFiddle: http://jsfiddle.net/kyV5U/

For example:

<ul class="segmented-control">
    <li id="any"><a href="#any">Any</a></li>
    <li id="all"><a href="#all">All</a></li>
</ul>
<div style="clear:both;"></div>

<ul class="segmented-control">
    <li id="any"><a href="#any">Any 2</a></li>
    <li id="all"><a href="#all">All 2</a></li>
</ul>
<div style="clear:both;"></div>

Thank you in advance for any help!

Answer №1

You must update the id and anchor tags for the following controls.

<body>
 <ul class="segmented-control">
    <li id="any-new"><a href="#any-new">Any</a></li>
    <li id="all-new"><a href="#all-new">All</a></li>
 </ul>
 <div style="clear:both;"></div>

 <ul class="segmented-control">
    <li id="any2-new"><a href="#any2-new">Any 2</a></li>
    <li id="all2-new"><a href="#all2-new">All 2</a></li>
 </ul>

 <div style="clear:both;"></div>
 <ul class="segmented-control">
    <li id="any3-new"><a href="#any3-new">Any 3</a></li>
    <li id="all3-new"><a href="#all3-new">All 3</a></li>
 </ul>
</body>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Connect the blade.php file with CSS in Laravel version 5.x

I placed my view.blade.php file in resources\views\admin\login\view.blade.php and used the following code to link it to the CSS file: <link href="{!! HTML::style('css/style.css') !!}" rel="stylesheet">. My CSS file is lo ...

Customize cell options in a dynamic grid within a dojo environment

When I double click on a cell in a data grid, I want to display a dropdown with information from a dojo store. However, the code I am using is not working as intended. I need to show clinician IDs stored in "clinStore" in the 'clinicianId' field ...

Avoid the automatic scrolling of a datatable to the top when clicking on a button within a column using jQuery

https://i.sstatic.net/Jx5G6.png Is there a method to stop the datatable from automatically scrolling to the top when any of the buttons is clicked? ...

Scoped Styles rarely stand a chance against more dominant styles

I'm facing a scope issue while learning Vue. Question: I am trying to make sure that the styles in profile.vue do not override the ones in sidebar.vue. I want the sidebar to have a red background and the profile section to be blue. Shouldn't usi ...

Can you suggest a solution for fixing this error in Angular Js?

I recently started learning Angular JS and encountered some issues while trying to implement routing. Click here for the error message <!DOCTYPE html> Main <a href="#!london">City 1</a> <a href="#!paris">City 2& ...

Get the maximum width in pixels through JavaScript when it is specified in different units within the CSS

I'm looking to retrieve the max-width value in px from CSS for use in a JavaScript code. The challenge is that this value might be specified in different units in the CSS file. Any suggestions on how to achieve this using JavaScript? const element = ...

PHP MySQL Table with a Date Range Filter

As someone who is new to PHP, I have a question. How can I set up a date range filter? I've looked at tutorials, but they haven't worked for me. I do have some code, but it doesn't include any functions. I want to implement this in a CRUD t ...

Using JavaScript to redirect browser with a specific string

My goal is to redirect all users who visit a specific URL to another page. While this redirection works effectively, I now need to implement it with a tracking URL. The issue arises when Javascript automatically adds a "/" in front of the tracking string ...

Combining Rails 3.1 authenticity tokens with the uploadify feature

Currently, I am facing an issue while trying to integrate Uploadify with my Rails 3.1 application. Despite setting up all the necessary steps such as middleware, initializers, and configuration, everything seems to be working correctly except for one parti ...

What's the easiest method for moving div content from side to side?

Working on a plugin for WordPress, I am faced with the task of moving content in a slider from left to right and right to left. My current attempt is as follows: var effect = 'slide'; // Set the options for the chosen effect type var opti ...

The container div with a gradient background doesn't support the use of height: auto

Currently, I am faced with the challenge of addressing this particular issue: The outer div ("container") is not allowing height:auto and instead conceals the entire content within the div - however, it is crucial for me that the outer div expands as it w ...

Incorporate negative padding in order to smoothly scroll to a specific ID

When I jump to an ID using domain.com/#section, the scroll goes too far down and needs a negative margin added. Is there a way to achieve this directly in the URL without relying on CSS, jQuery, or JavaScript? ...

Incorporating personalized CSS and JavaScript into Shopify

Currently, my project involves integrating vertical tabs into a Shopify page that is utilizing the 'Atlantic' theme. Since this particular theme doesn't come with vertical tabs built-in, I have incorporated external JS and CSS files known as ...

Troubleshooting JQuery Variable Overwriting Problem

Here is the code snippet I am working with: <script> $(document).ready(function() { var settings_image ={ url:"<?php echo site_url('/cms/editor/upload/images');?>", method: "POST", fileName: "file", returnType: ...

How can I implement JQuery colorbox in a JSP file without creating a new file for content within a specific div?

Currently, I am utilizing JQuery colorbox in the following way: A link (represented as a button) with the class cboxElement displays the html content of colorbox from another JSP file when clicked. Everything works smoothly up to this point. However, I am ...

Having trouble getting my Jquery Ajax post request to work with JSON data

I am working on syncing data from my Phonegap app back to the server. I have a PHP script set up on the server to handle the incoming data and now I need to figure out how to post values from my App to this script. Currently, I store my data in a SQLite d ...

In-line Vertical Ticker Display

I attempted to use vTicker, but I found that it does not function properly when used as an inline element. <h1> <div id="vticker"><ul>...</ul></div> Some other headline text </h1> My goal is to have the vertica ...

Is there a way for me to display a FontAwesome spinner on a button?

My HTML code utilizes Bootstrap and FontAwesome. Here is an example: <button type="submit" class="btn btn-primary"> <i class="fas fa-spinner fa-spin" style="display:none;"></i> ...

jQuery fails to hide DIVs when jQuery.show() has been utilized in a previous event

I've always considered myself pretty proficient in jQuery, but this particular issue has me stumped. Essentially, I have a click event that should hide one DIV (a placeholder) and show two others (an input section and control buttons section). However ...

Struggling to align elements vertically and horizontally using Bootstrap in an HTML file

Here is the code snippet that I have written: .box { background-color: red; } .container { height: 50vh; background-color: blue; } <!DOCTYPE html> <html lang="en"> <head> ...