Tailwind and Bootstrap dictionary

Created a small dictionary that helps translate Tailwind to Bootstrap classes

posted by Pfp of vladSink

updated
Blog post featured image

Bootstrap vs Tailwind CSS Classes Comparison

I have found a more relevant updated source for this.

These are some frequently used examples

Layout & Container

CategoryBootstrapTailwind
Containercontainer, container-fluidcontainer, mx-auto
Displayd-flex, d-grid, d-block, d-noneflex, grid, block, hidden
Flex Directionflex-row, flex-columnflex-row, flex-col
Flex Propertiesflex-grow-1, flex-shrink-0flex-1, flex-grow, shrink-0
Gridrow, col, col-12grid, grid-cols-12
Gapgap-1, gap-2, gap-3gap-1, gap-2, gap-4

Spacing

CategoryBootstrapTailwind
Marginm-1, m-2, m-3, m-4, m-5m-1, m-2, m-4, m-8, m-16
Margin Directionsmt-3, mb-3, ms-3, me-3mt-4, mb-4, ml-4, mr-4
Paddingp-1, p-2, p-3, p-4, p-5p-1, p-2, p-4, p-8, p-16
Padding Directionspt-3, pb-3, ps-3, pe-3pt-4, pb-4, pl-4, pr-4

Typography

CategoryBootstrapTailwind
Font Sizefs-1, fs-2, fs-3, fs-4, fs-5, fs-6text-xs, text-sm, text-base, text-lg, text-xl, text-2xl
Font Weightfw-bold, fw-normal, fw-lightfont-bold, font-normal, font-light
Text Aligntext-start, text-center, text-endtext-left, text-center, text-right
Text Colortext-primary, text-secondary, text-dangertext-blue-500, text-gray-500, text-red-500

Backgrounds & Colors

CategoryBootstrapTailwind
Background Colorbg-primary, bg-secondary, bg-successbg-blue-500, bg-gray-500, bg-green-500
Text Colortext-primary, text-muted, text-whitetext-blue-500, text-gray-500, text-white
Opacityopacity-25, opacity-50, opacity-75opacity-25, opacity-50, opacity-75

Borders & Shadows

CategoryBootstrapTailwind
Borderborder, border-1, border-2border, border-2, border-4
Border Colorborder-primary, border-secondaryborder-blue-500, border-gray-500
Border Radiusrounded, rounded-sm, rounded-lgrounded, rounded-sm, rounded-lg
Shadowshadow-sm, shadow, shadow-lgshadow-sm, shadow, shadow-lg

Positioning

CategoryBootstrapTailwind
Positionposition-relative, position-absoluterelative, absolute
Top/Right/Bottom/Lefttop-0, start-0, bottom-0, end-0top-0, right-0, bottom-0, left-0
Z-indexz-0, z-1, z-2, z-3z-0, z-10, z-20, z-30

Flexbox & Grid Utilities

CategoryBootstrapTailwind
Justify Contentjustify-content-start, justify-content-centerjustify-start, justify-center
Align Itemsalign-items-start, align-items-centeritems-start, items-center
Flex Wrapflex-wrap, flex-nowrapflex-wrap, flex-nowrap
Orderorder-1, order-2, order-3order-1, order-2, order-3

Responsive Design

CategoryBootstrapTailwind
Breakpointssm, md, lg, xl, xxlsm, md, lg, xl, 2xl
Usage Examplecol-md-6, d-lg-nonemd:w-1/2, lg:hidden

Hover & Focus States

CategoryBootstrapTailwind
Hover:hover (via CSS)hover:bg-blue-600, hover:text-white
Focus:focus (via CSS)focus:ring, focus:border-blue-500
Active:active (via CSS)active:bg-blue-700

Key Differences:

  1. Bootstrap uses descriptive class names (e.g., text-center), while Tailwind uses more atomic/utility classes
  2. Bootstrap uses numbered scale (1-5), Tailwind uses larger range and different scales
  3. Tailwind has more granular control over colors and sizes
  4. Bootstrap includes pre-built components, Tailwind is purely utility-first
  5. Bootstrap uses words like "start/end" for RTL support, Tailwind uses "left/right"
  6. Tailwind's responsive design uses prefixes, Bootstrap uses infix notation
  7. Tailwind has built-in state variants (hover:, focus:, etc.), Bootstrap relies more on CSS

Tell me what you think


Comments

LogIn to leave a comment