tailwind-css
  1. tailwind-css-stroke-width

Tailwind CSS Stroke Width

Tailwind CSS provides a utility class to adjust the stroke width of SVGs. Below you will find the syntax, an example, the output, an explanation, the use cases, important points, and a summary of the Tailwind CSS stroke width utility.

Syntax

The syntax for the Tailwind CSS stroke width utility is as follows:

<!-- stroke width of 1 -->
<svg stroke-width="1">...</svg>

<!-- stroke width of 2 -->
<svg class="stroke-2">...</svg>

<!-- stroke width of 4 -->
<svg class="stroke-4">...</svg>

<!-- stroke width of 8 -->
<svg class="stroke-8">...</svg>

<!-- stroke width of 16 -->
<svg class="stroke-16">...</svg>

Example

Here is an example of the Tailwind CSS stroke width utility in action:

<svg viewBox="0 0 24 24" stroke="currentColor" class="w-6 h-6 stroke-2">
  <path stroke-linecap="round" strokeLinejoin="round" strokeWidth="2" d="M4 6h16M4 12h8m-8 6h16" />
</svg>

Output

The output of the Tailwind CSS stroke width utility will be an SVG with the specified stroke width.

Explanation

The Tailwind CSS stroke width utility classes are a set of pre-defined CSS classes that set the stroke-width property of an SVG. The available values are 1, 2, 4, 8, and 16. These classes allow developers to quickly and easily adjust the stroke width of SVGs without having to manually specify the stroke-width property.

Use

The Tailwind CSS stroke width utility classes can be used to adjust the stroke width of SVGs in any project that uses Tailwind CSS.

Important Points

  • The Tailwind CSS stroke width utility classes only work with SVGs.
  • If a custom stroke-width value is needed, it can be manually set on the SVG.

Summary

The Tailwind CSS stroke width utility classes allow developers to quickly and easily adjust the stroke width of SVGs using pre-defined CSS classes. Available values are 1, 2, 4, 8, and 16. These utility classes only work with SVGs and are a helpful tool for any project that uses Tailwind CSS.

Published on: