覆盖 CSS 文本转换

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8675414/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 02:30:02  来源:igfitidea点击:

Override CSS text-transform

overridinginlinecss

提问by DanielAttard

I am using the following CSS which transforms all text to uppercase:

我正在使用以下 CSS 将所有文本转换为大写:

.taxtabs {
font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
font-size: .8em;
width: inherit;
text-align:center;
text-transform: uppercase;
border-collapse: collapse;
}

Now what I would like to do is to override this CSS and allow certain text to be lowercase. How would I do that? Perhaps using some kind of inline CSS? Thanks.

现在我想做的是覆盖这个 CSS 并允许某些文本为小写。我该怎么做?也许使用某种内联 CSS?谢谢。

回答by U-DON

Probably better to create a class that doesn't have any text-transform.

创建一个没有任何文本转换的类可能更好。

.normal {
    text-transform: none;
}

<div class="taxtabs">
... <span class="normal">this text is not uppercase</span> ...
</div>

回答by ThinkingStiff

Create a class for whatever elements you don't want capped and put text-transform: none !important;in it. I don't know your layout, so I put !importantfor good measure (for example if your element had both texttabsand overrideclasses).

为您不希望限制的任何元素创建一个类并将其放入text-transform: none !important;其中。我不知道你的布局,所以我!important采取了很好的措施(例如,如果你的元素同时具有texttabsoverride类)。

.override {
    text-transform: none !important;
}

回答by user192344

Not sure what you wanna to do

不确定你想做什么

if you only want to make some text to be lowercase

如果您只想将某些文本设为小写

you just have to add a new class on it or inherit above css

您只需要在其上添加一个新类或继承上面的 css

from

<label class="taxtabs">text</label>

to

<label class="taxtabs lower">text</label>
<style>.taxtabs.lower{text-transform: lowercase;}</style>

回答by sczizzo

Maybe add a new class called lowercaseto selected .textabsso you can define something like this:

也许添加一个名为lowercaseselected的新类,.textabs以便您可以定义如下内容:

.textabs.lowercase { text-transform: lowercase; }