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

General Discussion

What is the best place to put text?

In the html? Or CSS? Or Javascript? Just wondering what is more professional. What would load faster. I have seen in many different ways.

2 Answers

Steven Parker
Steven Parker
231,264 Points

The conventional roles for the components of a web page are that HTML is for the content, CSS is for styling and JavaScript is for functionality.

So without any more information, I would expect "text" would be considered part of the content and should therefore be included in the HTML.

Thank you. I was just wondering because when i go through the Internet I have seen people with only tags no text in the site. I was wondering if there was an actual reason to look more professional or more talented. Or thought it could be faster if you put it in css. But I will stick to keep it into the html.

Steven Parker
Steven Parker
231,264 Points

It could be that the code is loaded dynamically with JavaScript, which might make sense if the content changes very frequently, particularly if it updates "live" while you are viewing the page. But this would be unnecessary complexity for text that doesn't change.