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

Feeling like a total idiot

I'm starting the HTML deep dive and am getting along writing the language and everything, but it simply isn't... working. When Nick, in the video, writes code things are indented and highlight and turn different colors automatically. He refreshes the webpage and it does the things he wants it to do. For me, the HTML simply shows up on the page the way it's written in the TextEdit document rather than manipulating the web page the way it should. Am I doing something horribly wrong? I'm so confused...

8 Answers

Chase Lee
Chase Lee
29,275 Points

Is your file named "index.html"?

awryoyster
awryoyster
7,911 Points

Hi Jason! Did you use html tag? If you could paste your code here that would be easier to help :-)

Here's the code I used:

<!doctype html>

<html lang="en">
<head>
<meta charset="utf-8">
<title>My Page</title>
</head>
<body>
<div>This is a <div>div</div>.</div>
<span>This is a span.</span>
</body>

</html>
awryoyster
awryoyster
7,911 Points

If you are using text edit I think the problem is your file has a name of "index.html.txt" or something similar instead of "index.html". Your first code looks fine and meta tag can't be that important. Ages ago I wrote my code only in notepads with no meta tags and it was working fine.

I second this.

When you go to save your file, select "All File Types" instead of ".txt" under "Save File As". Even if you feel like you've done it, sometimes it's not done at all. :)

Alternatively, when you view your file in the folder, the "Type" should say "HTML File" not "Text File".

I did save it as "index.html". Here's the code:

<!doctype html>

<html lang="en">
<head>
<meta charset="utf-8">
<title>My Page</title>
</head>

</html>

Huh. That's different!

Chase Lee
Chase Lee
29,275 Points

Jason Bacaj I reformatted your code for you. You can find out how I did it here.

I'm opening it in firefox, does that make a difference?

Chase Lee
Chase Lee
29,275 Points

Try using this meta tag:

<meta http-equiv="Content-Type" content="text/html, charset=utf-8">
Alex Hedley
Alex Hedley
16,377 Points

You mentioned TextEdit, is that the app you're using? If so you should really use something like Sublime Text, Textastic, TextMate etc

Chase Lee
Chase Lee
29,275 Points

Yes that is very true. Although TextEdit does work.