bootstrap.min.css 和 bootstrap.css 有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23368456/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 02:21:34  来源:igfitidea点击:

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

csstwitter-bootstraptwitter-bootstrap-3

提问by Haxor

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

我应该在 bootstrap.min.css 或 bootstrap.css 之间使用什么?

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

我在这两个文件之间感到困惑,因为它bootstrap.css是可读的,即可以上下滚动。但是bootstrap.min.css很难编辑,因为您只能左右滚动它。

回答by forgivenson

bootstrap.min.csshas 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.

bootstrap.min.css已经缩小。这意味着所有空格和其他额外字符都已被删除。这通常用于生产中,以减少文件的大小。在开发时,使用未缩小版本通常会有所帮助,因为正如您所说,它是可读的。

EDIT: As mentioned by DrBeza in a comment, if your intention is to modify the bootstrap.cssfile, it is much better practice to create a separate .cssfile 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.cssto move your modifications over to it.

编辑:正如 DrBeza 在评论中提到的,如果您打算修改bootstrap.css文件,最好创建一个单独的.css文件并添加您自己的 css 规则来覆盖默认值。这样,如果您更新到较新版本的引导程序,您可以简单地换出引导程序文件,而无需编辑新文件bootstrap.css以将您的修改转移到它。

回答by Marco Prins

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

它们具有完全相同的功能,但.min.css版本已被缩小,这意味着已删除所有空格以减小文件大小并提高速度。

The normal .cssis 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.cssfor slightly better performance.

.css如果您想编辑和玩弄内容,则常规更适合开发,但如果您绝对不打算修改文件,请使用.min.css稍微更好的性能。

回答by Mohit Patel

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.

bootstrap.min.css 和 bootstrap.css 之间的主要差异是间距。在 bootstrap.min.css 文件中,所有的空格都被删除了,在 bootstrap.css 文件中,有空格。因此,与 bootstrap.min.css 相比,文件大小显然会更大。因此,作为开发人员,我们应该使用 bootstrap.min.css。

回答by Fouad Boukredine

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.

要点是:开发时使用 bootstrap.css,开发完成后使用 bootstrap.min.css(即:将代码中指向 bootstrap.css 的所有实例更改为 bootstrap.min.css)以加快加载速度并为最终用户提供更好的用户体验。