font

Shorthand for writing font-* rules in syntax like vanilla CSS font property, but without specifying the required font-family property.

Arguments

NameTypeDefaultDescription
$params *string|list|numberA set of rules for one or more of the following properties:
font-style, font-weight, font-size, line-height.
$font-family?stringnullThe font-family property value.

Example

@use 'more-sass' as more;

.element-one {
    @include more.font('italic 700 16px/1.5');
}

.element-two {
    @include more.font(32px);
}

.element-three {
    @include more.font('/1.2');
}

.element-four {
    @include more.font(16px, 'Agora Slab Pro');
}
.element-one {
    font-style: italic;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.5;
}

.element-two {
    font-size: 32px;
}

.element-three {
    line-height: 1.2;
}

.element-four {
    font-size: 16px;
    font-family: 'Agora Slab Pro';
}
Edit this page on GitHub Updated at Mon, Jan 30, 2023