What is the difference between bootstrap.min.css and bootstrap.css?

CssTwitter BootstrapTwitter Bootstrap-3

Css Problem Overview


What should I use between bootstrap.min.css or bootstrap.css?

I am confused between the two files because bootstrap.css is readable i.e. scrollable up & down. But the bootstrap.min.css is hard to edit since you can only scroll it left and right.

Css Solutions


Solution 1 - Css

bootstrap.min.css has been minified. This means all the whitespace and other extra characters have been removed. This is commonly done for use in production, to reduce the size of the file. When developing, it is usually helpful to use the unminified version, since, as you said, it is readable.

The way it works is that it takes all variables (for example number, tableName) and converts it to shorter names (in this example, it renames number to a, and tableName to b), so that the file becomes a little smaller (from 220 MB to 219 MB), that's essentially what it's doing, of course it does more, but this is one part where you can grasp what it does.

That's why there's no white spaces, because a whitespace takes up 0.1 MB and it's best without it.

EDIT: As mentioned by DrBeza in a comment, if your intention is to modify the bootstrap.css file, it is much better practice to create a separate .css file and add your own css rules that override the defaults. This way, if you update to a newer version of bootstrap, you can simply swap out the bootstrap files, instead of needing to edit the new bootstrap.css to move your modifications over to it.

Solution 2 - Css

They have exactly the same function, but the .min.css version has been minified, meaning all whitespace has been removed to reduce file size and increase speed.

The normal .css is better for development if you want to edit and play around with the content, but if you are definitely not going to modify the file, use the .min.css for slightly better performance.

Solution 3 - Css

The main diversity between bootstrap.min.css and bootstrap.css is spacing. In bootstrap.min.css file, All the white spaces has been removed where In bootstrap.css file, white spaces are there. So obviously file size will be larger as compare to bootstrap.min.css. For that reason, As a Developer, We should use bootstrap.min.css.

Solution 4 - Css

The Gist is this: Use bootstrap.css when developing, and use bootstrap.min.css when you're done developing (ie: change all instances in your code that points to bootstrap.css to bootstrap.min.css) for faster loading and better UX for the end user.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHaxorView Question on Stackoverflow
Solution 1 - CssforgivensonView Answer on Stackoverflow
Solution 2 - CssMarco PrinsView Answer on Stackoverflow
Solution 3 - CssMohit PatelView Answer on Stackoverflow
Solution 4 - CssFouad BoukredineView Answer on Stackoverflow