HTML Best Practices: Type attribute on script and style elements is not necessary in HTML5

Austin Songer
Code The World
Published in
1 min readJan 22, 2017

Since all browsers expect scripts to be JavaScript and styles to be CSS, you don’t need to include type attribute. While it isn’t really a mistake, it’s a best practice to avoid this pattern.

Bad example:

<link type="text/css" rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="script/scripts.js"></script>

Good example:

<link rel="stylesheet" href="css/style.css">
<script src="script/scripts.js"></script>

--

--

Austin Songer
Code The World

Trusted Veteran | Compassionate. Aspiring. Resourceful.