What could be causing my custom CSS to not take effect on a progress bar within my JSP page?

Struggling to incorporate a progress bar into my JSP page to track order status, I'm facing issues with applying custom CSS. Despite using !important to override conflicting styles, it seems like other frameworks (such as Bootstrap) might be taking precedence over my CSS. Even after adding !important to counteract Bootstrap styles, the custom CSS still fails to take effect. I have meticulously checked the HTML and confirmed that the classes are being rendered correctly.

<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ include file="/common/taglib.jsp"%>
<!DOCTYPE html>
<html lang="vi">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Trạng thái đơn hàng</title>
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" />
  <style>
    /* Custom CSS for step progress bar */
    .order-status-container {
      display: flex !important;
      justify-content: space-between !important;
      align-items: center !important;
    }

    /* Other CSS styles */

  </style>
</head>
<body>
<div class="container">
  <h2 class="text-center mt-5" style="padding-top: 60px;">Trạng thái đơn hàng</h2>

  <!-- Order status steps -->

</div>
//library 
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
</body>
</html>

Despite clearing browser cache and refreshing the page multiple times, the issue persists.

Answer №1

In my opinion, deleting all instances of "order-status-line" can solve the issue of overlap if you utilize the :before option for creating the progress bar. To determine the location of your elements and their associated styles, consider using the browser inspection tool.
It seems that you also desire the succeeding item to appear in green. Therefore, replace the following code:

.order-status-step.active + .order-status-step .order-status-line {
    background-color: #28a745 !important;
}

With this revised code:

.order-status-step.active + .order-status-step:before {
    background-color: #28a745 !important;
}

Moreover, refrain from using !important too liberally; familiarize yourself with CSS Specificity by referring to: https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity

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

Text successfully inserted into the input field using Xpath

I need help with the following issue: I am trying to use Selenium to verify if an input field contains a specific text that has been manually entered. Here is an example of an input field with the value '50': <input type="text" class="value ...

A common occurrence is for jQuery/Javascript Ajax POST to generate 6 identical posts when used within a .each loop, happening approximately 20

Context: Building a jQuery mobile phonegap application with multipage-ajaxload and sisyphus enabled form that utilizes an AJAX POST loop to interact with a GUI database. The process involves posting 171 section entries, along with one summary entry to a se ...

Replace the specific phrase in the passage using R

I have a task of identifying specific sentences within a paragraph and replacing them. Displayed below is the Dataframe - fulltext = c(rep("<span style=\"font-family:Calibri\"><span style=\"font-size:18px\">__ - Now</s ...

Displaying an Array in HTML using Angular

Just starting out with Angular and experimenting with data display from an array. The data in the array is: [Me, Three, Four] I attempted to loop through it for printing but encountered issues. Here's a snippet of how I'm currently handling it: ...

Adjust size of logo in navigation bar header

Having trouble resizing a logo within a navbar-header? Check out the code below: <nav class="navbar navbar-inverse"> <div class="container-fluid"> <div class="navbar-header"> <spa ...

Is it possible to adjust the background image with properties like Scale to Fill, Aspect Fit, or Aspect Fill?

Is it possible to set the background image using the following properties in HTML? (These are properties used for iOS images, but I am unsure if there are similar ones in HTML): Scale to Fill, Aspect Fit, Aspect Fill https://i.stack.imgur.com/5X83I.jpg ...

Vue.js displaying incorrectly on Windows Server 2019 IIS post deployment

Once I run npm serve, everything runs smoothly. However, when I deploy my app with an API in an ASP.NET application, it doesn't scale properly. I am using Router and History for navigation. Anonymous user authentication is enabled and static content h ...

Displaying videos in Vue js with full width and height is not working as expected

I am trying to create something similar to this: https://i.sstatic.net/R8VEy.png However, the video does not display in full height and width. Instead, it appears cut off at the edges and I cannot see the controls. I want the video to cover 100% of the ...

Remove the concluding statement from the HTML string if it exceeds the capacity of the iPhone's webView

I have an array of content with certain sections in bold. The bold parts can be located anywhere within the text, so I am utilizing a webView to display an HTML string with appropriate bold tags. However, I am encountering issues where the webViews do not ...

how to modify attributes of the :before pseudo-element using jQuery

Can you explain how to modify the property of the :before element? For instance: Using CSS: .myclass:before { content: ''; position: absolute; left: 40px; top: ...

Issues encountered when using Vue Transition in conjunction with v-autocomplete

Attempting to conditionally display or hide a selection text field using Vue's Transition feature, but experiencing an issue where the text field appears and disappears without any transition effect. <template> <Transition v-if="is ...

Placing an absolute div directly at the boundaries of an inline span

In my project, I am working on adding a feature where text can be selected with the help of "handles." These handles have to be positioned either on the left or right side of the inline span. For reference, here is an image: https://i.sstatic.net/U1XGe.jp ...

Ways to extract the partial text of the class value found within a tag

I need assistance retrieving the text 'completed' from the following HTML element: <div class="status"> <span class="statusText completed"></span> </div> xpath: //span[@class='statusText com ...

Is my PHP code impacted by this CSS styling?

After applying the CSS styles below to my login form, I am encountering an issue where my POST variables are showing up as NULL upon form submission. What could be causing this? Below is the CSS code used: #wrapper #Box input[type=text], textarea, input[ ...

Creating a 2 by 2 division grid using the float property and setting a minimum height

I currently have a 2 x 2 grid of divs, each set to float:left; with a width: 400px; inside a parent div with width:800px;. In order for the divs to expand as new content is added or removed, I've added min-height: 150px;. The issue arises when a div ...

While HTML and CSS collaborate seamlessly during development, CSS mysteriously disappears when transitioning to production mode

I am brand new to this field and I apologize in advance for any mistakes. Currently, I am working on a node.js project using webpack and HTML loader. To test the project, I am utilizing the dev server dependency to run it locally. All models, views, and te ...

Create a layout where a flexbox container is nested under another div and achieve the desired positioning

<style> .container{ display: flex; gap: 5px; flex-direction: row; justify-content: space-around; flex-wrap: wrap; overflow:auto; } .container .one{ background-color: blue; ...

Manipulating class and element text within an anchor element using jQuery

Here is the HTML code that I am working with: $(document).ready(function() { $(document).on('click', '#btnVisible', function(e) { // Logic Here return false; }); }); <script src="https://ajax.googleapis.com/ajax/libs ...

Trigger animation once you've scrolled past a designated point in the document

I created a count-up counter animation using JavaScript, but the issue is that the counter starts animating as soon as I refresh the page regardless of where I am on the page or if the counter is even visible. I would like the counter to only start workin ...

require an array that contains an embedded object

When making a post request, I need to include an array with an object inside. I have observed that adding new properties inside an object works fine. However, when attempting to add properties while the object is inside an array, it does ...