Issue with text-indent not working correctly in Firefox when using overflow hidden

I am currently working on a progress bar that utilizes text-indent to display text in the middle of the progress.

Everything seems to be functioning correctly in Chrome and IE, but for some reason it's not working in Firefox. (surprising, right?)

Take a look at the discrepancy between Chrome and Firefox:

http://jsfiddle.net/ZGyaz/1/

For an animated version, visit:

http://jsfiddle.net/ZGyaz/19/

HTML

<div class="container">
    <div class="bars bar1">sametext</div>
    <div class="bars bar2">sametext</div>
</div>

CSS

.container{
    border:1px solid #09c;
    height: 20px;
    width: 100%;
    position: relative;
}

.container .bars{
    text-indent: 45%;
    position: absolute;
    top:0;
    font-family: arial;
    color: #09c;
}

.container .bar2{
    background-color: #09c;
    width: 50%;
    color: #fff;
    overflow: hidden;
}

The width in bar2 and text-indent are both dynamic variables designed to showcase the expected result as the progress bar fills up.

Answer №1

This appears to be a new issue with Gecko that has not been documented before. I have submitted a report at https://bugzilla.mozilla.org/show_bug.cgi?id=908707

In the meantime, can you try using a text-indent value that is not a percentage as a temporary solution?

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

Using jQuery .css({}) is not causing negative margin to function as expected

$('#thankYouMessage').css({"height": textHeight, "margin-top:": "-52px", "padding-left": "19px"}); The CSS property 'padding-left:' will be applied as expected, but the negative margin will not take effect. The 'margin-top:' ...

quirky behavior of form inputs on mobile devices in a responsive webpage

I encountered a strange issue while developing a responsive webpage with form input. Whenever I tapped on an input field on my mobile phone to enter something, the screen would zoom in and cut off the text box on the left side, making it impossible to see ...

What is the best option: using a Javascript template or exploring another

Just starting out in web development. I want to include the same menu on every page of my new website, but I don't want to manually update it in each file whenever there's a change. Is there an easy template engine for JavaScript or another sol ...

How can I attach :after and :before pseudo-elements to a submit button?

I'm attempting to enhance my submit button with :after/:before elements, but I'm having trouble getting it to work properly. Specifically, I want to add a swipe (Sweep To Right) transition effect on the button from left to right. Similar to - th ...

Styling with CSS for an associative array with multiple columns

How can I modify this PHP function to display its output within a scrolling text box with word wrap in CSS? <?php function prettyPrint( $my_array ) { if (is_array($my_array)) { echo "<table style=border=0 cellspacing=2 cellpadding ...

Is there a way to have the submit button show the uploaded file on the same page, without redirecting to a new

My code seems to be malfunctioning and I suspect it's due to some errors. I'm attempting to have the submit button display an image of a molecule using JSmol. Can anyone lend a hand with this? <script> var Molecule = { width: 550, ...

Selenium: Linux Troubleshooting - Unable to Find Browser Executables

My current goal is to automate browsing tasks on Linux using Selenium (I'm specifically working on Linux Mint 20). However, I've encountered a roadblock: the browser binaries cannot be located. I attempted with both Firefox and Chromium, but unfo ...

Pressing the button will add text into the input field

Below is a jsfiddle link showcasing the current issue I am trying to address: http://jsfiddle.net/YD6PL/61/ Here is the HTML code snippet: <input type="text> <input type="text> <input type="text> <div> <button class="buttons"& ...

How to retrieve the optgroup label from a Bootstrap Select dropdown

Currently, I am working with a BootStrap select box and my goal is to identify the optgroup of the option that has been selected. The following code snippet showcases a bootstrap select box with different options: <li rel="1"> <div class="div- ...

How come my Bootstrap 4 navbar-brand is occupying an entire row?

Struggling to create a standard navbar using Bootstrap 4? I'm facing an issue where the navbar items are not aligning properly as per the code copied from the Bootstrap website. Despite keeping the menu items short, they still move to a separate line ...

Semi-fixed positioning with flex layout

I am encountering an issue with angular's flex-layout. I have implemented two divs with fxFlex, each containing a mat-card. My goal is to keep the right mat-card vertically fixed while maintaining responsive behavior when resizing the window. Does any ...

Creating unique image control buttons for each image within a div using a combination of CSS and JavaScript

How can I create image control buttons, such as close, resize, and rotate, for each individual image when hovering over it? Each image is contained within a draggable div. I want to display an image control button next to each image. This button should on ...

align the button to the left using bootsrap configuration

Is there a way to align a button to the left using bootswatch/Litera, which is a bootstrap 4 beta theme? I attempted to use the float-left class on the button and place it inside a div, but the outcome remained the same. https://i.sstatic.net/qs4zU.png ...

Making sure all items in the top row of Flexbox columns have the same height

Within my flex wrapper, I have multiple column components with various flex items inside. Each column displays content adjacent to each other. The challenge is to ensure that the top item in each column has an equal height, creating a row-like effect. I&a ...

MUI: Interaction with a button inside a MenuItem when not interacted with MenuItem itself?

Currently, I am utilizing MUI's Menu / MenuItem to create a menu of missions / tasks similar to the screenshot below: https://i.sstatic.net/6FGrx.png The MenuItem is interactive: // ... other code <MenuItem value={mission.issu ...

Utilizing the CSS grid framework to efficiently create repetitive rows and columns in code

When I work with CSS frameworks like Bootstrap or Materialize, I often find myself repeatedly typing the same HTML code: <div class="row"> <div class="col s12"> <!-- Some text/ a button / something --> </div> </d ...

Is there a way to illuminate a complete row by simply hovering over a span within one of the columns?

If I want to change the background-color of a div with classes "row" and "highlightThisRow" when hovering over a span with the class "fromThisSpan", how can I achieve that? In a list, there are multiple rows with several columns. The span in question is l ...

The Bootstrap dropdown feature is acting up when included in the header PHP file

I'm having an issue where the dropdown in my header.php file is not working when I include it in my home.php page. The navigation bar appears correctly, but the dropdown feature doesn't work. Can someone please assist me with this? Below are the ...

The HTML div is not aligned in the center even when using flexbox

After creating a list within a centered flex div, it seems that the list is not aligning properly. I used flex on the list-div2 and the translate rule in the parent's middle-text div, but it still doesn't look centered as expected. Can anyone p ...

Develop a unique splitter code that utilizes pure javascript and css, allowing users to drag and drop with precision

I am facing an issue with setting the cursor above my drop panel, as it results in a flicker effect. How can I set the cursor for my example to work properly? I have tried multiple different approaches to make this work. Although I am using the provided ...