migration.html 16.4 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
---
layout: default
title: Migrating to v3.x
slug: migration
lead: "Guidance on how to upgrade from Bootstrap v2.x to v3.x with emphasis on major changes, what's new, and what's been removed."
---


<!-- Migration
================================================== -->
<div class="bs-docs-section">
  <h1 class="page-header">Migrating from 2.x to 3.0</h1>

  <p class="lead">Bootstrap 3 is not backwards compatible with v2.x. Use this section as a general guide to upgrading from v2.x to v3.0. For a broader overview, see <a href="http://blog.getbootstrap.com/2013/08/19/bootstrap-3-released/">what's new</a> in the v3.0 release announcement.</p>

  <h2 id="classes">Major class changes</h2>
  <p>This table shows the style changes between v2.x and v3.0.</p>
  <div class="table-responsive">
    <table class="table table-bordered table-striped">
      <thead>
        <tr>
          <th>Bootstrap 2.x</th>
          <th>Bootstrap 3.0</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td><code>.row-fluid</code></td>
          <td><code>.row</code></td>
        </tr>
        <tr>
          <td><code>.span*</code></td>
          <td><code>.col-md-*</code></td>
        </tr>
        <tr>
          <td><code>.offset*</code></td>
          <td><code>.col-md-offset-*</code></td>
        </tr>
        <tr>
          <td><code>.brand</code></td>
          <td><code>.navbar-brand</code></td>
        </tr>
        <tr>
          <td><code>.navbar .nav</code></td>
          <td><code>.navbar-nav</code></td>
        </tr>
        <tr>
          <td><code>.nav-collapse</code></td>
          <td><code>.navbar-collapse</code></td>
        </tr>
        <tr>
          <td><code>.nav-toggle</code></td>
          <td><code>.navbar-toggle</code></td>
        </tr>
        <tr>
          <td><code>.btn-navbar</code></td>
          <td><code>.navbar-btn</code></td>
        </tr>
        <tr>
          <td><code>.hero-unit</code></td>
          <td><code>.jumbotron</code></td>
        </tr>
        <tr>
          <td><code>.icon-*</code></td>
          <td><code>.glyphicon .glyphicon-*</code></td>
        </tr>
        <tr>
          <td><code>.btn</code></td>
          <td><code>.btn .btn-default</code></td>
        </tr>
        <tr>
          <td><code>.btn-mini</code></td>
          <td><code>.btn-xs</code></td>
        </tr>
        <tr>
          <td><code>.btn-small</code></td>
          <td><code>.btn-sm</code></td>
        </tr>
        <tr>
          <td><code>.btn-large</code></td>
          <td><code>.btn-lg</code></td>
        </tr>
        <tr>
          <td><code>.alert</code></td>
          <td><code>.alert .alert-warning</code></td>
        </tr>
        <tr>
          <td><code>.alert-error</code></td>
          <td><code>.alert-danger</code></td>
        </tr>
        <tr>
          <td><code>.visible-phone</code></td>
          <td><code>.visible-xs</code></td>
        </tr>
        <tr>
          <td><code>.visible-tablet</code></td>
          <td><code>.visible-sm</code></td>
        </tr>
        <tr>
          <td><code>.visible-desktop</code></td>
          <td>Split into <code>.visible-md .visible-lg</code></td>
        </tr>
        <tr>
          <td><code>.hidden-phone</code></td>
          <td><code>.hidden-xs</code></td>
        </tr>
        <tr>
          <td><code>.hidden-tablet</code></td>
          <td><code>.hidden-sm</code></td>
        </tr>
        <tr>
          <td><code>.hidden-desktop</code></td>
          <td>Split into <code>.hidden-md .hidden-lg</code></td>
        </tr>
        <tr>
          <td><code>.input-block-level</code></td>
          <td><code>.form-control</code></td>
        </tr>
        <tr>
          <td><code>.control-group</code></td>
          <td><code>.form-group</code></td>
        </tr>
        <tr>
          <td><code>.control-group.warning .control-group.error .control-group.success</code></td>
          <td><code>.form-group.has-*</code></td>
        </tr>
        <tr>
          <td><code>.checkbox.inline</code> <code>.radio.inline</code></td>
          <td><code>.checkbox-inline</code> <code>.radio-inline</code></td>
        </tr>
        <tr>
          <td><code>.input-prepend</code> <code>.input-append</code></td>
          <td><code>.input-group</code></td>
        </tr>
        <tr>
          <td><code>.add-on</code></td>
          <td><code>.input-group-addon</code></td>
        </tr>
        <tr>
          <td><code>.img-polaroid</code></td>
          <td><code>.img-thumbnail</code></td>
        </tr>
        <tr>
          <td><code>ul.unstyled</code></td>
          <td><code>.list-unstyled</code></td>
        </tr>
        <tr>
          <td><code>ul.inline</code></td>
          <td><code>.list-inline</code></td>
        </tr>
        <tr>
          <td><code>.muted</code></td>
          <td><code>.text-muted</code></td>
        </tr>
        <tr>
          <td><code>.label</code></td>
          <td><code>.label .label-default</code></td>
        </tr>
        <tr>
          <td><code>.label-important</code></td>
          <td><code>.label-danger</code></td>
        </tr>
        <tr>
          <td><code>.text-error</code></td>
          <td><code>.text-danger</code></td>
        </tr>
        <tr>
          <td><code>.table .error</code></td>
          <td><code>.table .danger</code></td>
        </tr>
        <tr>
          <td><code>.bar</code></td>
          <td><code>.progress-bar</code></td>
        </tr>
        <tr>
          <td><code>.bar-*</code></td>
          <td><code>.progress-bar-*</code></td>
        </tr>
        <tr>
          <td><code>.accordion</code></td>
          <td><code>.panel-group</code></td>
        </tr>
        <tr>
          <td><code>.accordion-group</code></td>
          <td><code>.panel .panel-default</code></td>
        </tr>
        <tr>
          <td><code>.accordion-heading</code></td>
          <td><code>.panel-heading</code></td>
        </tr>
        <tr>
          <td><code>.accordion-body</code></td>
          <td><code>.panel-collapse</code></td>
        </tr>
        <tr>
          <td><code>.accordion-inner</code></td>
          <td><code>.panel-body</code></td>
        </tr>
      </tbody>
    </table>
  </div><!-- /.table-responsive -->

  <h2 id="new">What's new</h2>
  <p>We've added new elements and changed some existing ones. Here are the new or updated styles.</p>
  <div class="table-responsive">
    <table class="table table-bordered table-striped">
      <thead>
        <tr>
          <th>Element</th>
          <th>Description</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>Panels</td>
          <td><code>.panel .panel-default</code> <code>.panel-body</code> <code>.panel-title</code> <code>.panel-heading</code> <code>.panel-footer</code> <code>.panel-collapse</code></td>
        </tr>
        <tr>
          <td>List groups</td>
          <td><code>.list-group</code> <code>.list-group-item</code> <code>.list-group-item-text</code> <code>.list-group-item-heading</code></td>
        </tr>
        <tr>
          <td>Glyphicons</td>
          <td><code>.glyphicon</code></td>
        </tr>
        <tr>
          <td>Jumbotron</td>
          <td><code>.jumbotron</code></td>
        </tr>
        <tr>
          <td>Extra small grid (&lt;768px)</td>
          <td><code>.col-xs-*</code></td>
        </tr>
        <tr>
          <td>Small grid (&ge;768px)</td>
          <td><code>.col-sm-*</code></td>
        </tr>
        <tr>
          <td>Medium grid (&ge;992px)</td>
          <td><code>.col-md-*</code></td>
        </tr>
        <tr>
          <td>Large grid (&ge;1200px)</td>
          <td><code>.col-lg-*</code></td>
        </tr>
        <tr>
          <td>Responsive utility classes (&ge;1200px)</td>
          <td><code>.visible-lg</code> <code>.hidden-lg</code></td>
        </tr>
        <tr>
          <td>Offsets</td>
          <td><code>.col-sm-offset-*</code> <code>.col-md-offset-*</code> <code>.col-lg-offset-*</code></td>
        </tr>
        <tr>
          <td>Push</td>
          <td><code>.col-sm-push-*</code> <code>.col-md-push-*</code> <code>.col-lg-push-*</code></td>
        </tr>
        <tr>
          <td>Pull</td>
          <td><code>.col-sm-pull-*</code> <code>.col-md-pull-*</code> <code>.col-lg-pull-*</code></td>
        </tr>
        <tr>
          <td>Input height sizes</td>
          <td><code>.input-sm</code> <code>.input-lg</code></td>
        </tr>
        <tr>
          <td>Input groups</td>
          <td><code>.input-group</code> <code>.input-group-addon</code> <code>.input-group-btn</code></td>
        </tr>
        <tr>
          <td>Form controls</td>
          <td><code>.form-control</code> <code>.form-group</code></td>
        </tr>
        <tr>
          <td>Button group sizes</td>
          <td><code>.btn-group-xs</code> <code>.btn-group-sm</code> <code>.btn-group-lg</code></td>
        </tr>
        <tr>
          <td>Navbar text</td>
          <td><code>.navbar-text</code></td>
        </tr>
        <tr>
          <td>Navbar header</td>
          <td><code>.navbar-header</code></td>
        </tr>
        <tr>
          <td>Justified tabs / pills</td>
          <td><code>.nav-justified</code></td>
        </tr>
        <tr>
          <td>Responsive images</td>
          <td><code>.img-responsive</code></td>
        </tr>
        <tr>
          <td>Contextual table rows</td>
          <td><code>.success</code> <code>.danger</code> <code>.warning</code> <code>.active</code> <code>.info</code></td>
        </tr>
        <tr>
          <td>Contextual panels</td>
          <td><code>.panel-success</code> <code>.panel-danger</code> <code>.panel-warning</code> <code>.panel-info</code></td>
        </tr>
        <tr>
          <td>Modal</td>
          <td><code>.modal-dialog</code> <code>.modal-content</code></td>
        </tr>
        <tr>
          <td>Thumbnail image</td>
          <td><code>.img-thumbnail</code></td>
        </tr>
        <tr>
          <td>Well sizes</td>
          <td><code>.well-sm</code> <code>.well-lg</code></td>
        </tr>
        <tr>
          <td>Alert links</td>
          <td><code>.alert-link</code></td>
        </tr>
      </tbody>
    </table>
  </div><!-- /.table-responsive -->

  <h2 id="dropped">What's removed</h2>
  <p>The following elements have been dropped or changed in v3.0.</p>
  <div class="table-responsive">
    <table class="table table-bordered table-striped">
      <thead>
        <tr>
          <th>Element</th>
          <th>Removed from 2.x</th>
          <th>3.0 Equivalent</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>Form actions</td>
          <td><code>.form-actions</code></td>
          <td class="text-muted">N/A</td>
        </tr>
        <tr>
          <td>Search form</td>
          <td><code>.form-search</code></td>
          <td class="text-muted">N/A</td>
        </tr>
        <tr>
          <td>Form group with info</td>
          <td><code>.control-group.info</code></td>
          <td class="text-muted">N/A</td>
        </tr>
        <tr>
          <td>Fixed-width input sizes</td>
          <td><code>.input-mini</code> <code>.input-small</code> <code>.input-medium</code> <code>.input-large</code> <code>.input-xlarge</code> <code>.input-xxlarge</code></td>
          <td>Use <a href="../css/#forms-controls"><code>.form-control</code></a> and <a href="../css/#grid">the grid system</a> instead.</td>
        </tr>
        <tr>
          <td>Block level form input</td>
          <td><code>.input-block-level</code></td>
          <td>No direct equivalent, but <a href="../css/#forms-controls">forms controls</a> are similar.</td>
        </tr>
        <tr>
          <td>Inverse buttons</td>
          <td><code>.btn-inverse</code></td>
          <td class="text-muted">N/A</td>
        </tr>
        <tr>
          <td>Fluid row</td>
          <td><code>.row-fluid</code></td>
          <td><code>.row</code> (no more fixed grid)</td>
        </tr>
        <tr>
          <td>Controls wrapper</td>
          <td><code>.controls</code></td>
          <td class="text-muted">N/A</td>
        </tr>
        <tr>
          <td>Controls row</td>
          <td><code>.controls-row</code></td>
          <td><code>.row</code> or <code>.form-group</code></td>
        </tr>
        <tr>
          <td>Navbar inner</td>
          <td><code>.navbar-inner</code></td>
          <td class="text-muted">N/A</td>
        </tr>
        <tr>
          <td>Navbar vertical dividers</td>
          <td><code>.navbar .divider-vertical</code></td>
          <td class="text-muted">N/A</td>
        </tr>
        <tr>
          <td>Dropdown submenu</td>
          <td><code>.dropdown-submenu</code></td>
          <td class="text-muted">N/A</td>
        </tr>
        <tr>
          <td>Tab alignments</td>
          <td><code>.tabs-left</code> <code>.tabs-right</code> <code>.tabs-below</code></td>
          <td class="text-muted">N/A</td>
        </tr>
        <tr>
          <td>Pill-based tabbable area</td>
          <td><code>.pill-content</code></td>
          <td><code>.tab-content</code></td>
        </tr>
        <tr>
          <td>Pill-based tabbable area pane</td>
          <td><code>.pill-pane</code></td>
          <td><code>.tab-pane</code></td>
        </tr>
        <tr>
          <td>Nav lists</td>
          <td><code>.nav-list</code> <code>.nav-header</code></td>
          <td>No direct equivalent, but <a href="../components/#list-group">list groups</a> and <a href="../javascript/#collapse"><code>.panel-group</code>s</a> are similar.</td>
        </tr>
        <tr>
          <td>Inline help for form controls</td>
          <td><code>.help-inline</code></td>
          <td>No exact equivalent, but <code>.help-block</code> is similar.</td>
        </tr>
        <tr>
          <td>Non-bar-level progress colors</td>
          <td><code>.progress-info</code> <code>.progress-success</code> <code>.progress-warning</code> <code>.progress-danger</code></td>
          <td>Use <code>.progress-bar-*</code> on the <code>.progress-bar</code> instead.</td>
        </tr>
      </tbody>
    </table>
  </div><!-- /.table-responsive -->

  <h2 id="notes">Additional notes</h2>
  <p>Other changes in v3.0 are not immediately apparent. Base classes, key styles, and behaviors have been adjusted for flexibility and our <em>mobile first</em> approach. Here's a partial list:</p>
  <ul>
    <li>By default, text-based form controls now receive only minimal styling.  For focus colors and rounded corners, apply the <code>.form-control</code> class on the element to style.</li>
    <li>Text-based form controls with the <code>.form-control</code> class applied are now 100% wide by default. Wrap inputs inside <code>&lt;div class="col-*"&gt;&lt;/div&gt;</code> to control input widths.</li>
    <li><code>.badge</code> no longer has contextual (-success,-primary,etc..) classes.</li>
    <li><code>.btn</code> must also use <code>.btn-default</code> to get the "default" button.</li>
    <li><code>.row</code> is now fluid.</li>
    <li>Images are no longer responsive by default. Use <code>.img-responsive</code> for fluid <code>&lt;img&gt;</code> size.</li>
    <li>The icons, now <code>.glyphicon</code>, are now font based. Icons also require a base and icon class (e.g. <code>.glyphicon .glyphicon-asterisk</code>).</li>
    <li>Typeahead has been dropped, in favor of using <a href="http://twitter.github.io/typeahead.js/">Twitter Typeahead</a>.</li>
    <li>Modal markup has changed significantly. The <code>.modal-header</code>, <code>.modal-body</code>, and <code>.modal-footer</code> sections are now wrapped in <code>.modal-content</code> and <code>.modal-dialog</code> for better mobile styling and behavior. Also, you should no longer apply <code>.hide</code> to <code>.modal</code> in your markup.</li>
    <li>As of v3.1.0, the HTML loaded by the <code>remote</code> modal option is now injected into the <code>.modal-content</code> (from v3.0.0 to v3.0.3, into the <code>.modal</code>) instead of into the <code>.modal-body</code>. This allows you to also easily vary the header and footer of the modal, not just the modal body.</li>
    <li>The checkbox and radio features of the button.js plugin now both use <code>data-toggle="buttons"</code> instead of <code>data-toggle="buttons-checkbox"</code> or <code>data-toggle="buttons-radio"</code> in their markup.</li>
    <li>JavaScript events are namespaced. For example, to handle the modal "show" event, use <code>'show.bs.modal'</code>. For tabs "shown" use <code>'shown.bs.tab'</code>, etc.</li>
  </ul>
  <p>For more information on upgrading to v3.0, and code snippets from the community, see <a href="http://bootply.com/">Bootply</a>.</p>
</div>