CSS text-transform: capitalize Issue

Status
Not open for further replies.
I'm working with an ASP.NET project that has exposed me to an interesting issue. The specific control I'm having a problem with defines a class and that corresponding CSS entry defines the text-transform property and sets it to capitalize. The problem comes in when I mention that the text this is applied to is something like "Your document(s) are being uploaded" and Chrome and IE interpret this CSS property (apparently correctly, according to this ancient discussion)to mean the final text should be "Your Document(S) Are Being Uploaded" (notice the capital "S" in parentheses). Firefox treats this appropriately (from an English grammar standpoint) and displays it as "Your Document(s) Are Being Uploaded".

My question is this: is there any way for me to override this CSS property for just this instance? I have very limited experience with CSS and I am tempted to remove the class attribute from the control and just copy/paste the other style settings there while making sure the source text is properly capitalized, but that is obviously something I'd rather avoid.

Any alternatives would be much appreciated.
 
npHardProblem":1m2rvd84 said:
Use of !important is, in most cases, a pretty big CSS smell. But based on the class name there I am guessing your CSS is pretty far gone already, so I suppose I wouldn't worry about it too much unless you want to embark on a big CSS "refactor".

An excellent observation on the state of this CSS :)

This is a years old application that I've just started up on so yes, my mission is to disturb as little of the creaky CSS infrastructure as possible while getting this specific control to capitalize "correctly" from a user standpoint.

Besides doing a big refactor, is there a "recommended" way to handle this sort of situation?
 
In this specific case !important is likely fine unless you want to trace the offending style back to its source and remove it. If you can do that without messing up a bunch of other controls, that'd be the "preferred" solution, but it's harder and may actually be impossible depending on how the other widgets work.

CSS is pretty much impossible to refactor IMO since there is no real possibility of unit/integration testing. You can never be 100% sure that you've preserved all of the styles you're supposed to keep, short of running image diffs on screenshots. (I have actually thought about writing something to do this, but have never gone through with it)

Even assuming the existence of that sort of acceptance test, it's very hard to refactor small pieces of CSS at a time unless there's a disciplined cascade & class hierarchy. And if you have that, you probably don't need to refactor :)
 
npHardProblem":2h5x4jx8 said:
In this specific case !important is likely fine unless you want to trace the offending style back to its source and remove it. If you can do that without messing up a bunch of other controls, that'd be the "preferred" solution, but it's harder and may actually be impossible depending on how the other widgets work.

CSS is pretty much impossible to refactor IMO since there is no real possibility of unit/integration testing. You can never be 100% sure that you've preserved all of the styles you're supposed to keep, short of running image diffs on screenshots. (I have actually thought about writing something to do this, but have never gone through with it)

Even assuming the existence of that sort of acceptance test, it's very hard to refactor small pieces of CSS at a time unless there's a disciplined cascade & class hierarchy. And if you have that, you probably don't need to refactor :)

That's reassuring to hear. This particular style is being used in many places throughout the app and the hard-coded text (of course it is hard-coded) contained in the code-behind files generally depends on the text-transform: capitalize property to do the capitalization. Even if I were to update any instances I find in aspx/aspx.cs files, I still would have to worry about the countless javascript files that are dynamically generating content to render, so I'm glad the !important trick is available to me. Aren't you all glad you aren't on this project?
 
Status
Not open for further replies.