Implementing distinct CSS styles for both a tab page and progress bar within the same webpage using JQuery UI

I'm currently facing a challenge with incorporating a JQueryUI Progress Bar into a web page that already utilizes the styling of a JQueryUI Tab. The visual appearance of the tab panel and tabs has been customized using CSS, including the use of the .ui-widget-header value which is also applied to the Progress Bar.

My issue lies in needing the Progress Bar to have a different style defined within the .ui-widget-header CSS class separate from what is set for the Tabs. Specifically, I believe the border property within the .ui-widget-header style needs to be adjusted. I suspect that this can be achieved through CSS by targeting specific IDs, but I am unsure of the correct approach.

Attached is an HTML example file illustrating the problem. It showcases the desired look for the tabs while seeking a distinct style for the Progress Bar (with a full border and solid progress meter).

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" type="text/css" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script>
    <title>Test</title>
  </head>
  <body>
<script type="text/javascript" language="javascript">
<!--
//Tabs
$(function(){
    $('#tabs').tabs();
    $("#progressbar").progressbar({ value: 0 });
    setTimeout(updateProgress, 500);
});

function updateProgress() {
  var progress;
  progress = $("#progressbar")
    .progressbar("option","value");
  if (progress < 100) {
      $("#progressbar")
        .progressbar("option", "value", progress + 1);
      setTimeout(updateProgress, 500);
  }
}
// -->
</script>
<style type="text/css">
.ui-widget { font-family: Arial, sans-serif; font-size: 1.1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Arial, sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #ffffff; background: #ffffff}
.ui-widget-content a { color: #333333; }
.ui-widget-header { border: 1px solid #FFFFFF; border-bottom:solid 1px #056B2E; background:none; font-weight:normal;}
 </style>
  <div id="bodycontent">
    <!-- Tabs -->
    <div id="tabs">
      <ul>
        <li><a href="#tabs-1">test 1</a></li>
        <li><a href="#tabs-2">test 2</a></li>
      </ul>
      <div id="tabs-1">
        Test 1 Content
      </div>
      <div id="tabs-2">
        Test 2 Content
      </div>
    </div>
    <br/>
    <br/>
    <div id="progressbar"></div>
  </div>
  </body>
</html>

Answer №1

To customize the UI appearance, make sure to place your CSS after the default UI styles. The progress bar is identified by the following class:

ui-progressbar-value ui-widget-header ui-corner-left

In your CSS file, include the following code:

ui-progressbar-value ui-widget-header {border:1px solid #000000}

This will override the default UI style for the progress bar.

Answer №2

After some experimentation, I managed to achieve the desired outcome by incorporating these CSS rules with the utilization of an ID selector in order to specifically modify certain attributes within my progressbar ID:

div#progressbar.ui-widget-content { border: 1px solid #000000; background:none; font-weight:normal;}
div#progressbar .ui-widget-header { border: 1px solid #000000; background:none; font-weight:normal;}
div#progressbar .ui-progressbar-value {background:#008B3A;}

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

"Enhance your website design with a full-width element using Boostrap that align

Whenever my div is scrolled to, it becomes fixed. At that point, I want the div to expand to full width. I achieved this by adding width: 100% to the div. However, the issue is that I want the content of the div to align with the rest of the page content, ...

Creating a div with relative positioning and a height of 100% in Bootstrap

I am attempting to design a left sidebar on my webpage with the main content positioned to the right of it. However, I am facing an issue where setting the sidebar div to 100% height requires using position: absolute; which causes the content to overlap th ...

What is the optimal resolution for a background image in a Cordova app?

Currently working on a Cordova application that requires different background images for various screens. Despite using media queries to provide the background image in different resolutions, we are facing an issue where the background image is not displ ...

Step-by-step guide on how to load an Ext JS tab after clicking on it

I have an Ext JS code block that creates 4 tabs with Javascript: var tabs; $(document).ready( function() { fullscreen: true, renderTo: 'tabs1', width:900, activeTab: 0, frame:true, ...

JavaScript Equivalent of jQuery's removeClass and addClass Functions

I am faced with the challenge of rewriting the following code without using jQuery: document.querySelector('.loading-overlay').classList.remove('hidden'); Can anyone provide guidance on how this can be achieved? ...

Wave Filter in SVG

While attempting to create a fisheye-esque filter in my SVG, I came across this interesting codepen example: http://codepen.io/johanberonius/pen/RopjYW The effect works well, but I would like it to be a bit more pronounced. Unfortunately, I am unable to m ...

Utilize Ajax to seamlessly insert data into a MySQL database using PHP

Seeking Help with Implementing Ajax in my Code for Form Submission I am a beginner and have successfully written this code, but now I want to incorporate Ajax to avoid page reloads. Can anyone assist me with this? PHP File //Code For Making Form And ...

What is the right way to nest a SCSS rule for a specific selector within a list using the "&" symbol?

I have a question that I couldn't find the answer to in any documentation or on Stack Overflow. While this example may not be perfect, it should give you a basic understanding of what I'm trying to achieve. Illustration .btn-group { .btn ...

Enhance the code for updating the content within a div element

I recently discovered that utilizing jQuery allows for updating the content within a div. My goal now is to enhance this script so the content remains consistent, even while loading or not. Take a look at my current code: function changeContent () { va ...

Importing a CSS file into your Angular project's index.html file

I am currently facing a challenge while trying to utilize the angular2-busy library within an Angular project that was generated using the CLI. The issue arises when attempting to import the stylesheet: <link rel="stylesheet" href="/node ...

Tips on updating the outer ripple color of radio buttons in Angular 6 Material

I was trying to customize the default color of Angular Material Radio buttons. I managed to change the radio button color successfully. <mat-radio-group> <mat-radio-button value="1">Option 1</mat-radio-button> <mat-radio-button va ...

Maintaining checkbox state using fetch arrays

Included below is the code present on my site, pulling data for each season including numbers of home wins, win percentage, and win lsp. It functions correctly by creating a new table row for each season. Furthermore, there are two columns featuring filte ...

How can I prevent the background hover color from spreading from the descriptive section to the item section in Qualtrics?

Let me start off by apologizing for any confusion in the wording of this question. I'm trying my best to be clear. Essentially, I have two goals: I managed to program a tooltip with a table into the question area of Qualtrics. I want the background ...

Creating a legitimate string using a function for jqGrid editoptions value: What's the best way to do it?

I am encountering an issue while trying to create a string for the editoptions value using a function. The desired string format is as follows: '1:Active;2:Inactive;3:Pending;4:Suspended'. Strangely, when I manually input this string as the value ...

What is the best way to hide a section of an image using the background of a different div?

How can I make the background of div2 cover the image in div1 when setting margin-top=-50px? Code snippet: <html> <head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> ...

Using a slider in Cordova application

Currently, I am in the process of developing an app using Cordova. However, I have encountered an issue with the slider feature. HTML <body> <div id="slider"> <div id="custom-handle" class="ui-slider-handle"></div> </di ...

Ways to iterate and combine two associative arrays in jQuery

I have a total of 15 sections, each known as bases, with their own alphabet buttons. My goal is to link the alphabet letters with their corresponding base/section. For instance, if a user clicks on the letter "B" under base 7, I want to show that the user ...

Older versions of Internet Explorer, specifically IE 8 and below, are causing issues with iframe

I am currently working on a website that includes an embedded Vimeo video. The majority of our target audience uses IE8 or older, and interestingly enough, most of them have their browsers zoomed to 125% view. Unfortunately, while everything else on the si ...

The cards in the Bootstrap layout stack on top of one another when viewed on a mobile screen

I have a "flipping card" and another bootstrap 4 card positioned side by side. However, when tested on a mobile screen using Chrome's dev console, the second card overlaps the flipping card and covers it completely. To provide some context, I've ...

Is jQuery Mobile designed with a "mobile first" approach?

As a web developer, I have immersed myself in the concept of "mobile first" after reading Luke WROBLEWSKI's book and various other resources on the topic. I am now a firm believer in the approach of starting with mobile design and gradually enhancing ...