Border Width

    Utilities for controlling the width of an element’s borders.

    Show all classes

    Use the , border-0, border-2, border-4, or border-8 utilities to set the border width for all sides of an element.

    Individual sides

    Use the border-{side}, border-{side}-0, border-{side}-2, border-{side}-4, or border-{side}-8 utilities to set the border width for one side of an element.

    Border Width - 图2

    1. <div class="border-t-4 border-indigo-500 ..."></div>
    2. <div class="border-b-4 border-indigo-500 ..."></div>
    3. <div class="border-l-4 border-indigo-500 ..."></div>

    Between elements

    You can also add borders between child elements using the divide-{x/y}-{width} and divide-{color} utilities.

    Border Width - 图4

    1. <div class="divide-y divide-slate-200 ...">
    2. <div>02</div>
    3. <div>03</div>
    4. </div>

    Learn more in the Divide Width and documentation.


    Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use to only apply the border-t-4 utility on hover.

    For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.

    Breakpoints and media queries

    1. <div class="border-2 md:border-t-4">
    2. <!-- ... -->
    3. </div>

    To learn more, check out the documentation on Responsive Design, and other media query modifiers.


    By default, Tailwind provides five border-width utilities, and the same number of utilities per side (horizontal, vertical, top, right, bottom, and left). You change, add, or remove these by editing the theme.borderWidth section of your Tailwind config.

    tailwind.config.js

    Learn more about customizing the default theme in the documentation.

    Arbitrary values

    If you need to use a one-off border-{side}-{width} value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value.

    1. <div class="border-t-[3px]">

    Learn more about arbitrary value support in the documentation.