Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Objects Includes and iframes

Marcel Moritz
Marcel Moritz
15,111 Points

'type' attribute in header tags

Do I really need the 'type' attribute in tags like <script> and <link>. I tried it out and it seems that everything is working properly. Wouldn't it be lighter to leave them?

3 Answers

James Barnett
James Barnett
39,199 Points

If you are talking about the <link>, <script> & <style> elements then yes you can leave out the type attribute for those elements. Although you aren't likely save any space.

source:

Wayne Priestley
Wayne Priestley
19,579 Points

I would suggest trying to keep your code as semantic as possible where you can, the few tags you need to do this really isn't going to make any difference at all to your code size.

It would be probably lighter to leave them out, but not by much. If you're trying to be really aggressive with future code, you could include them, but understand the cost of potentially having to update later because it isn't officially adopted or because it has no real use going forward. You need to determine what your goal is, but for now, it's not going to be impactful for you to leave it out.