简体   繁体   English

在元素的所有子元素中放大 css 字体大小的任何灵丹妙药?

[英]Any magic bullet for scaling up css font sizes in all subelements of an element?

Basically, while implementing a 3rd party cookie consent thingy, the font sizes on everything are far too small.基本上,在实现第 3 方 cookie 同意时,所有内容的字体大小都太小了。 The good news is that all of their widgets have the same root element, the bad news is that only the "leaflet" elements contain inline css that determines the font size.好消息是他们所有的小部件都有相同的根元素,坏消息是只有“传单”元素包含决定字体大小的内联 css。

Is there any css option to scale up all the font sizes in all the contained elements of an element?是否有任何 css 选项可以放大元素的所有包含元素中的所有字体大小?

Maybe "important" would fix it in this case, depending on the ruthlessness of the third-party styling.也许“重要”会在这种情况下解决它,这取决于第三方样式的无情。 (Tho, important-rules should not be used all that often) (虽然,重要的规则不应该经常使用)

.third-party-root-element h1 { font-size: 40px !important; }
.third-party-root-element h2 { font-size: 32px !important; }
.third-party-root-element p { font-size: 18px !important; }

Otherwise controlling the font-size based on your own "root-size":否则根据您自己的“根大小”控制字体大小:

.third-party-root-element * { font-size: 1rem !important; }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM