-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Progress bar should handle the 0% case #12848
Comments
Confirmed. This problem applies more generally to any low percentage value with a decent amount of label text. |
The docs suggest adding a min-width for low percentages. That worked well for me. It was just the 0% case that really didn't work. Here is another (better, I think) solution that uses the
|
Probably better to use a specific var for color rather than $text-color. |
Here's another jsbin with the working code: http://jsbin.com/juwij/1/ It does the following:
|
Pushed up a change for this. I ended up using a fixed pixel width because single digit percentages are going to always be about the same size while the percent widths can vary greatly in computed widths. |
Thanks, btw! <3 |
* upstream/master: (45 commits) fix twbs#12936 Run `grunt update-shrinkwrap` [email protected] Fixes twbs#12901: Refactors list group active state for use on non-anchors nav Fixes twbs#12848: Account for and document progress bars at 0-3% use full version number in deprecation note clarify deprecation /cc @cvrebert Fixes twbs#12697: Document readonly inputs docs for twbs#12873 grunt after merging twbs#12917 Grunt after merging twbs#12863 grunt Fixes twbs#12868: Enables icon feedback on validation states for large/small inputs. Fixes twbs#12913: Remove scoped media queries from custom xs grid mixins Fixes twbs#12914: Darken immediate children hr elements in jumbotrons Fixes twbs#12916: Don't let .lead resize on viewport change add svg logos to brand guidelines Update csscomb properties. 'colon-spac'e and 'stick-brace' don't take boolean values. grunt ... Conflicts: dist/css/bootstrap.css.map dist/css/bootstrap.min.css
I'm not really sure why this was added? If your progress bar doesn't have text, it causes it to jump 30px for the first 3% points, then (depending on the size of the bar) jump backwards at 4%. Why are we assuming all progress bars contain text anyway? |
@cdmckay Yeah, hear that. Maybe we remove the 1-2% thing? This might be too specific for particular use cases and not for everyone. |
@mdo Yeah, it was very confusing to me at first, as I couldn't understand why my progress bar was jumping around. A further problem is that, even if someone has text in their progress bar, not everyone is putting "3%". They might be putting "3 / 100" or "300 / 1000", and there's no way to reliably handle that. |
X-Ref: http://stackoverflow.com/questions/16981763/invert-css-font-color-depending-on-background-color |
@cvrebert There is always this: |
We could move it to a modifier class &/or look for a different way of making sure text isn't cut off. On Wed, May 21, 2014 at 11:28 AM, Jonathan Hefner
|
@jonathanhefner Interesting, but has some issues: http://css-tricks.com/adding-stroke-to-web-text/ |
@cvrebert Using text-shadow as per the article you linked (plus a filter for IE9) should get the desired effect, no? What issues do you foresee? |
@jonathanhefner What about IE8? |
The Stack Overflow answer I linked to says the filter "works in IE5.5 through IE9." |
Lol, we won't be doing text stroke or shadow for this—thanks though @jonathanhefner. @stubbornella If you have specific ideas, feel free to pull request something. I've got a few other things to peep first before getting back to this for the v3.2 release. |
At the risk of repeating myself, see Thoughtbot's Refills for a fix to the original problem: font-weight: bold;
color: #FFF;
text-shadow: 0px 0px 1px #000; (To properly see it in action, you'll need to change the width of their |
It took me a while to figure out the reason for unexpected progress-bar behavior was being caused by this CSS rule change. It's not a desirable default to have min-width for values |
This was subsequently reverted; see #13953. |
I noticed that the progress bar doesn't handle the 0% progress case gracefully. The text is white on a light gray background and touches the edge of the outer bar.
http://jsbin.com/waver/1/
Perhaps I've not set some necessary variable or I was meant to add a class?
I ended up fixing it like this: (though it feels a bit clunky)
Happy to put together a pull request if this seems useful.
The text was updated successfully, but these errors were encountered: