Align minuses (-) in savings

Topic summary

A Shopify developer is working to align negative signs (-) in discount amounts within a cart drawer. The goal is to have all minus signs start at the same horizontal position across different discount line items (Product Discounts, Shipping Discount, Other Discounts) and align with the Total Savings minus sign.

Solutions Proposed:

  • LizHoang suggested modifying the HTML markup to separate the minus sign from the dollar amount using <span> elements with specific CSS classes for alignment control.

  • websensepro provided a CSS-only solution targeting specific cart drawer elements using nth-child selectors, setting a fixed width (62px) and left text alignment. This approach included a visual result showing the aligned minus signs.

Current Status:

The issue remains unresolved. After implementing one of the solutions, the original poster reports that while working on the cart, the alignment broke again, with items no longer positioned correctly. They’ve shared a new screenshot showing the misalignment and requested additional help.

Summarized with AI on November 2. AI used: claude-sonnet-4-5-20250929.

Hello, I got this code:


  
  

    Subtotal:
    $500.00
  

  
  
    

      Product Discounts:
      -$90.00
    

    
      Shipping Discount:
      -$9.99
    

    
      Other Discounts:
      -$20.00
    

  

  
  
    Total Savings:
    -$110.01
  

  
  
    Total:
    $380.01
  

which results in:

URL: Wall Art – Transform Your Space with Style and Elegance – InteriorGlows
But I want to align the - from the discounts to start at the same time as the - from the total savings will start.

For example:
Discount -200

Discount 2 -10

Total savings -200

Instead of

Discount -20

Discount 2 -900

Total savings -920

Hi @TrendBlend

To align the - signs in your discount amounts with the total savings, you can adjust the CSS styles.

Here’s a modified version of your code that ensures the - signs align properly, you can try this code:

  

    
  
  
    Subtotal:  
    $500.00  
  
  

    
    
    
  
      Product Discounts:  
      - $90.00  
    
  
      
      Shipping Discount:  
      - $9.99  
    
  
      
      Other Discounts:  
      - $20.00  
    
  
  
  

    
    
    Total Savings:  
    - $110.01  
  
  

    
    
    Total:  
    $380.01  
  
  

I hope it helps.

Liz

Hi @TrendBlend

  1. Go to Online Store β†’ Theme β†’ Edit code.
  2. Open your theme.css / based.css file and paste the code in the bottom of the file.
.cart-drawer__footer>div>div:nth-child(2)>div>span:nth-child(2) {
    width: 62px !important;
    text-align: left !important;
}

Result:

If my reply is helpful, kindly click like and mark it as an accepted solution.
If you are happy with my help, you can help me buy a COFFEE
Thanks!

1 Like

Hello @websensepro I’m finally done with creating the card, but now the items are not placed perfectly anymore. Can you please help me so the - shows as in the picture below: