Skip to content

This repository provides a comprehensive yet straightforward guide for migrating from Bootstrap v3 to v5. It is based on my personal experience migrating a legacy project and includes practical tips and examples. Additionally, I’ve included some essential jQuery instructions that may help during the migration process.

Notifications You must be signed in to change notification settings

ameyabodhani/bootstrap-migration-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Bootstrap v3 to v5 Migration Guide

Class Name Changes

Layout & Display

  • text-righttext-end
  • text-lefttext-start
  • hiddend-none
  • display: blockdisplay: flex (evaluate case by case)
  • img-responsiveimg-fluid

Components

  • .label.badge (evaluate case by case)
  • panelcard (evaluate case by case)
  • panel-bodycard-body
  • panel-titlecard-title
  • panel-headingcard-header
  • panel panel-defaultcard
  • panel panel-infocard border-info
  • panel-groupcard-group

Buttons & Navigation

  • btn-defaultbtn-light
  • btn-secondarybtn-default
  • activenav-link active (for nav nav-pills)
  • navbar-headernavbar-brand
  • navbar-togglenavbar-toggler
  • navbar-leftnavbar-nav me-auto
  • navbar-rightnavbar-nav ms-auto

Forms

  • form-groupform-group row (evaluate case by case)
  • input-group-addoninput-group-text

Data Attribute Changes

  • data-toggledata-bs-toggle
  • data-parentdata-bs-parent
  • data-targetdata-bs-target
  • data-dismissdata-bs-dismiss
  • data-targetdata-bs-slide (for carousel controls)

Icon Migration

Glyphicon to Font Awesome

  • glyphicon glyphicon-trashfa fa-trash-o
  • glyphicon glyphicon-okfa fa-check
  • glyphicon glyphicon-pencilfa fa-pencil
  • glyphicon glyphicon-eye-openfa fa-eye
  • fa fa-removefa fa-times

Removed Features

  • <span class="caret"></span> is removed in Bootstrap 5
    • Replace with <span class="dropdown-toggle"></span>

jQuery Updates

  1. Update jQuery files:

    • Copy new jquery.js and jquery UI files to project folder
    • Update file references in JSP files
    • Remove old JS files
    • Replace jquery.min.js in jqGrid-4.1.2/js/i18n/ with new version
  2. Verification:

    • Check jQuery version in browser console
    • Test all jQuery-dependent functionality

Grid System Updates

Example of updated grid classes:

<div class="offset-sm-2 offset-md-2 offset-lg-2 col-sm-4 col-md-4 col-lg-4">

Migration Checklist

  1. Update Bootstrap CDN or local files to v5
  2. Update jQuery and related dependencies
  3. Search and replace class names systematically
  4. Update data attributes
  5. Replace Glyphicon icons with Font Awesome equivalents
  6. Test responsive layouts
  7. Verify component functionality
  8. Check for browser compatibility

Common Issues to Watch For

  1. Layout shifts due to spacing/margin changes
  2. Icon rendering issues after Glyphicon replacement
  3. jQuery compatibility with new Bootstrap version
  4. Form validation behavior changes
  5. Modal and dropdown functionality
  6. Responsive navigation behavior

Additional Notes

  • Always test thoroughly after migration
  • Consider browser compatibility
  • Document any custom fixes or workarounds
  • Keep Bootstrap 5 documentation handy for reference

About

This repository provides a comprehensive yet straightforward guide for migrating from Bootstrap v3 to v5. It is based on my personal experience migrating a legacy project and includes practical tips and examples. Additionally, I’ve included some essential jQuery instructions that may help during the migration process.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published