border-y-2

Tailwind CSS border width utility for controlling element borders. The border-y-2 class applies a custom border width.

Class Information

CSS Class

border-y-2

CSS Properties

border-top-width: 2px;
border-bottom-width: 2px;
border-style: solid;

Live Examples

Border Width Examples

Content

2px border on top and bottom sides

<div class="border-y-2 border-blue-500">
  Content
</div>

All Border Width Options

Default (All Sides)

Top

Bottom

Left/Right

X/Y Axis

Start/End

Usage Guidelines

✅ Common Use Cases:

  • border-0: Remove borders completely
  • border (1px): Default thin borders for cards, inputs
  • border-2: Medium borders for emphasis
  • border-4: Thick borders for strong visual separation
  • border-8: Very thick borders for design elements
  • Directional borders: Create dividers and separators

💡 Pro Tips:

  • Combine with border colors: border-2 border-blue-500
  • Use directional borders for dividers: border-r border-gray-300
  • Focus states: focus:border-2 focus:border-blue-500
  • Responsive borders: border md:border-2
  • X/Y axis for symmetric borders: border-x-2
  • Start/End for RTL support: border-s-2