search
HomeWeb Front-endFront-end Q&AWhat is the difference between bootstrap v4 v3

Difference: 1. bootstrap v4 is written in Sass language, v3 is written in Less language; 2. v4 has 5 grid classes, v3 has 4 grid classes; 3. v3 uses px as the unit, v4 Use rem and em as units; 4. v3 uses float layout and v4 uses flexbox layout.

What is the difference between bootstrap v4 v3

The operating environment of this tutorial: Windows7 system, Bootstrap3&&Bootstrap4 version, DELL G3 computer

Differences

##LessSass language writing4 types of grid classes5 types of grid classesUse px as unitUse rem and em is the unit (except for some margins and padding that use px) Use push and pull to move left and rightOffset columns are set by the offset-classUse the float layout methodSelect the flexible box model (flexbox)
Bootstrap3 Bootstrap4
The four grids of Bootstrap3:


  • Extra small (col-xs-) Adapted to mobile phones (
  • Small (col-sm-) Adapted to tablets (≥768px)

  • Medium (col-md-) Suitable for computers (≥992px)

  • ##Large (col-lg-) Suitable For widescreen computers (≥1200px)
  • 5 grids for Bootstrap4:

    Extra small (col-)(

    small(col-sm-)(≥576px)
  • ##中(col-md-)(≥768px)
  • Large (col-lg-) (≥992px)
  • Extra large (col-xl-) (≥1200px)
  • Bootstrap4 Features

The new grid layer is adapted to the mobile terminal;
  • Comprehensive introduction of ES6 new Features (rewrite all JavaScript plugins);
  • css files reduced by at least 40%;
  • All documents rewritten with Markdown editor ;
  • Abandon support for IE8
  • Note:

Bootstrap3 cannot be used in Bootstrap4 The hidden-xs, visible-xs classes in

If you want to hide at a certain size in Bootstrap 4, you should refer to the following table

It’s worth mentioning What's more, using hidden-sm in B3 will only hide the sm size, and other sizes will be displayed normally. In B4, if you simply specify d-sm-none, the element will be hidden in the sm size, but the size above sm will be hidden. It will also be hidden, and the size under sm will be displayed normally. This involves the issue of upward compatibility, so when you set the sm element to be hidden, you must also set the md size display, as shown in the table above, and so on for others.

Hide upward compatibility , showing downward compatibility


Bootstrap3 and Bootstrap4 vertical and horizontal centering:

Bootstrap3 horizontal centering

// 文本:
class ="text-center"
// 图片居中:
class = "center-block"

bootstrap4 Horizontal centering:

Under flex: For example, p.row

align-items-center can center the internal elements vertically

justify-content-center can center the internal elements vertically Elements are centered horizontally

align-self-center Elements are centered

Pictures are centered: .d-block .mx-auto

Recommended learning: "

bootstrap usage tutorial

The above is the detailed content of What is the difference between bootstrap v4 v3. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
CSS IDs vs Classes: which is better for accessibility?CSS IDs vs Classes: which is better for accessibility?May 10, 2025 am 12:02 AM

Classesarebetterforaccessibilityinwebdevelopment.1)Classescanbeappliedtomultipleelements,ensuringconsistentstylesandbehaviors,whichaidsuserswithdisabilities.2)TheyfacilitatetheuseofARIAattributesacrossgroupsofelements,enhancinguserexperience.3)Classe

CSS: Understanding the Difference Between Class and ID SelectorsCSS: Understanding the Difference Between Class and ID SelectorsMay 09, 2025 pm 06:13 PM

Classselectorsarereusableformultipleelements,whileIDselectorsareuniqueandusedonceperpage.1)Classes,denotedbyaperiod(.),areidealforstylingmultipleelementslikebuttons.2)IDs,denotedbyahash(#),areperfectforuniqueelementslikeanavigationmenu.3)IDshavehighe

CSS Styling: Choosing Between Class and ID SelectorsCSS Styling: Choosing Between Class and ID SelectorsMay 09, 2025 pm 06:09 PM

In CSS style, the class selector or ID selector should be selected according to the project requirements: 1) The class selector is suitable for reuse and is suitable for the same style of multiple elements; 2) The ID selector is suitable for unique elements and has higher priority, but should be used with caution to avoid maintenance difficulties.

HTML5: LimitationsHTML5: LimitationsMay 09, 2025 pm 05:57 PM

HTML5hasseverallimitationsincludinglackofsupportforadvancedgraphics,basicformvalidation,cross-browsercompatibilityissues,performanceimpacts,andsecurityconcerns.1)Forcomplexgraphics,HTML5'scanvasisinsufficient,requiringlibrarieslikeWebGLorThree.js.2)I

CSS: Is one style more priority than another?CSS: Is one style more priority than another?May 09, 2025 pm 05:33 PM

Yes,onestylecanhavemoreprioritythananotherinCSSduetospecificityandthecascade.1)Specificityactsasascoringsystemwheremorespecificselectorshavehigherpriority.2)Thecascadedeterminesstyleapplicationorder,withlaterrulesoverridingearlieronesofequalspecifici

What are the significant goals of the HTML5 specification?What are the significant goals of the HTML5 specification?May 09, 2025 pm 05:25 PM

ThesignificantgoalsofHTML5aretoenhancemultimediasupport,ensurehumanreadability,maintainconsistencyacrossdevices,andensurebackwardcompatibility.1)HTML5improvesmultimediawithnativeelementslikeand.2)ItusessemanticelementsforbetterreadabilityandSEO.3)Its

What are the limitations of React?What are the limitations of React?May 02, 2025 am 12:26 AM

React'slimitationsinclude:1)asteeplearningcurveduetoitsvastecosystem,2)SEOchallengeswithclient-siderendering,3)potentialperformanceissuesinlargeapplications,4)complexstatemanagementasappsgrow,and5)theneedtokeepupwithitsrapidevolution.Thesefactorsshou

React's Learning Curve: Challenges for New DevelopersReact's Learning Curve: Challenges for New DevelopersMay 02, 2025 am 12:24 AM

Reactischallengingforbeginnersduetoitssteeplearningcurveandparadigmshifttocomponent-basedarchitecture.1)Startwithofficialdocumentationforasolidfoundation.2)UnderstandJSXandhowtoembedJavaScriptwithinit.3)Learntousefunctionalcomponentswithhooksforstate

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version