CSS 如何在 Stylus 的用户样式中将字体大小设置为@container 本身?

问题描述 投票:0回答:0

我在 Chrome 中使用手写笔扩展, 尝试将多个站点的主要内容设置为每行某个字符, 我首先尝试的是:

@-moz-document url-prefix("https://www.google.com/search?q=") {
.g {
    container-type: inline-size;
    font-size: 5cqw
}
}

@-moz-document url-prefix("https://www.zhihu.com/question/") {
.RichContent {
    container-type: inline-size;
    font-size: 5cqw
}
}

但它工作不正确, 因为——难道不能在容器本身上使用

cpw
吗?

我更新了我的代码,然后它就可以工作了:

@-moz-document url-prefix("https://www.google.com/search?q=") {
.g {
    container-type: inline-size
}
.g > div {
    font-size: 5cqw
}
}

@-moz-document url-prefix("https://www.zhihu.com/question/") {
.RichContent {
    container-type: inline-size
}
.RichContent-inner {
    font-size: 5cqw
}
}

在第三次尝试中,我尝试将重复部分放在一个地方,例如:

@-moz-document regexp(".*") {
@container(min-width:1px) {
    :first-child {
        font-size: 5cqw
    }
}
}

@-moz-document url-prefix("https://www.google.com/search?q=") {
.g {
    container-type: inline-size
}
}

@-moz-document url-prefix("https://www.zhihu.com/question/") {
.RichContent {
    container-type: inline-size
}
}

是的,我知道它不能正常工作...... 我该如何继续前进?

css stylus userstyles
© www.soinside.com 2019 - 2024. All rights reserved.