是否可以在 html 中使用 2 种尺寸类型制作宽度?

is it possible in html to make width with 2 size types?

我正在学习 html 并且,我问你能否使用 2 种或更多尺寸类型来制作宽度,比如我希望宽度为 10px+3vw 这样是不可能的,但有没有办法像类型转换或其他让它工作的东西,因为我知道 3 种类型的调整宽度 1-XX% ,2-XXpx 和 3-XXvw 你能在一个宽度属性中使用它们中的三个来完全控制它的宽度吗?

您正在寻找 calc()

width: calc(10px + 3vw);

您可以疯狂使用 calc 并提供任意数量的输入。

width: calc(10px + 3vw + 6vmin + 4% + 1em);

它还支持其他基本算术运算。

width: calc(100% / 7);

div
{
    display: inline-block;
    height: 100px;
    width: calc(10px + 3vw);
    background: red;
}
<div></div>