Sublime Text 的 Emmet 插件，在生成 script 和 style 标签时，都不带 type 声明：
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Document</title> <style></style> <script></script> </head> <body> </body> </html>
而 PHPStorm 在快捷生成标签的时候，却自带 type，但是 PHPStorm 过重。
为了搞清楚这个 type 声明是否必须，今天查了一些资料，这里记录下：
What does type="text/css" within the HTML code <style type="text/css"> mean?
What does it mean?
When I removed it, nothing changed.
Or also for inline style sheets?
Answer Man · 6 years ago
It means that the code inside the <style type="text/css"> and end </style> tags is css coding, if there is nothing in it, then nothing will change.
Newer browsers don’t necessarily need that but older ones do, so if you do not see a change, there might be a change on IE 6 and lower.
For inline style sheets you just add it to whatever tag, i.e.
If you remove that style tag the color will go to default and the padding will be removed.
The html 5 spec says that the type attribute is purely advisory and explains in detail how browsers should act if it’s omitted (too much to quote here). It doesn’t explicitly say that an omitted type attribute is either valid or invalid, but you can safely omit it knowing that browsers will still react as you expect.
Which is better or more convenient to use:
Do you need a type attribute at all? If you’re using HTML5, no. Otherwise, yes.
which are also defined in this document, are intended for common use and should be used instead.
The SCRIPT element