SVG
Utilities for styling the stroke width of SVG elements.
Class | Styles |
---|---|
stroke-<number> | stroke-width: <number>; |
stroke-(length:<custom-property>) | stroke-width: var(<custom-property>); |
stroke-[<value>] | stroke-width: <value>; |
Use stroke-<number>
utilities like stroke-1
and stroke-2
to set the stroke width of an SVG:
<svg class="stroke-1 ..."></svg><svg class="stroke-2 ..."></svg>
This can be useful for styling icon sets like Heroicons.
Use the stroke-[<value>]
syntax to set the stroke width based on a completely custom value:
<div class="stroke-[1.5] ..."> <!-- ... --></div>
For CSS variables, you can also use the stroke-(length:<custom-property>)
syntax:
<div class="stroke-(length:--my-stroke-width) ..."> <!-- ... --></div>
This is just a shorthand for stroke-[length:var(<custom-property>)]
that adds the var()
function for you automatically.
Prefix a stroke-width
utility with a breakpoint variant like md:
to only apply the utility at medium screen sizes and above:
<div class="stroke-1 md:stroke-2 ..."> <!-- ... --></div>
Learn more about using variants in the variants documentation.
Tailwind CSS 中文网(本网站)的目标是为中文开发者提供准确、及时的 Tailwind CSS 中文文档
Tailwind CSS 中文文档由本网站维护人员共同翻译,采用 MIT 开源协议发布
本网站与 tailwindcss.com 及 Tailwind Labs Inc. 并无从属关系
Tailwind 商标由 Tailwind Labs Inc. 所有
京ICP备15031610号-8