Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.