Width Utilities
Width utilities control the max width (inline-size) of elements.
Unlike most frameworks, width utilities are not mapped to percentages in ACSS. Rather, they’re a calculation based on your website’s Content Width. This is much more useful, since percentages cause complications with the responsive size of elements.
Standard Width Classes (10 to 90)
The syntax for width classes is .width--[value] with the value being 10-90 in increments of 10.
Example output for these width classes:
calc(var(--content-width) * .2)
As mentioned previously, this results in a fixed width calculation rather than a percent value. And since they use max-inline-size, they’re automatically responsive and won’t create overflow issues.
Special Width Classes
ACSS contains the following special width classes that exist outside of the above syntaxes.
.content-widthandvar(--content-width): Matches the content width of your website..content-width--safeandvar(--content-width-safe): “Safe content width” utilities with a virtual gutter..width--full: Sets an element to 100% width..width--max-content: Sets the inline size tomax-contentand themax-inline-sizeto 100%..width--min-content: Sets the inline size tomin-contentand themax-inline-sizeto 100%..width--fit-contentSets width to fit the content (usesfit-content).
Width Variables
The standard width values all have tokens/variables available for use, e.g. var(--width-30).