Leaving out the last semicolon of a CSS block

后端 未结 9 654
梦毁少年i
梦毁少年i 2020-11-27 15:43

A couple of questions concerning this:

  • Is it good practice?
  • Will it, on a large scale, result in better load times?
  • Can it result in browsers
9条回答
  •  野性不改
    2020-11-27 16:20

    • Is it good practice?

    In my opinion, no. If you add a rule below the last rule, it's easy to forget to add the semicolon.

    • Will it, on a large scale, result in better load times?

    Can't imagine that it would make much of a difference in load time.

    • Can it result in browsers 'breaking'?

    No, semicolons are only required to separate rules in CSS blocks. Semicolons are delimiters, not terminators.

    • Is the same true for the last function in Javascript (/jQuery)?

    Yes, don't leave it up the JavaScript interpreter to add semicolons.

提交回复
热议问题