Movatterモバイル変換


[0]ホーム

URL:


  1. Borders
  2. outline-width

Borders

outline-width

Utilities for controlling the width of an element's outline.

ClassStyles
outline
outline-width: 1px;
outline-<number>
outline-width:<number>px;
outline-(length:<custom-property>)
outline-width: var(<custom-property>);
outline-[<value>]
outline-width:<value>;

Examples

Basic example

Useoutline oroutline-<number> utilities likeoutline-2 andoutline-4 to set the width of an element's outline:

outline

outline-2

outline-4

<button class="outline outline-offset-2 ...">Button A</button>
<button class="outline-2 outline-offset-2 ...">Button B</button>
<button class="outline-4 outline-offset-2 ...">Button C</button>

Applying on focus

Prefix anoutline-width utility with a variant likefocus:* to only apply the utility in that state:

Focus the button to see the outline added

<button class="outline-offset-2 outline-sky-500focus:outline-2 ...">Save Changes</button>

Learn more about using variants in thevariants documentation.

Using a custom value

Use theoutline-[<value>] syntax to set the outline width based on a completely custom value:

<div class="outline-[2vw] ...">
<!-- ... -->
</div>

For CSS variables, you can also use theoutline-(length:<custom-property>) syntax:

<div class="outline-(length:--my-outline-width) ...">
<!-- ... -->
</div>

This is just a shorthand foroutline-[length:var(<custom-property>)] that adds thevar() function for you automatically.

Responsive design

Prefix anoutline-width utility with a breakpoint variant likemd: to only apply the utility at medium screen sizes and above:

<div class="outlinemd:outline-2 ...">
<!-- ... -->
</div>

Learn more about using variants in thevariants documentation.

Copyright © 2025 Tailwind Labs Inc.·Trademark Policy

[8]ページ先頭

©2009-2025 Movatter.jp