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

Megan Cassidy
Megan Cassidy
1,308 Points

Web page shows coding

I'm currently practicing my coding in TextEdit, and having trouble when attempting to open my .html file online. Everything that is on the document shows, instead of just the words designated to show. Assistance would be much appreciated.

Megan Cassidy
Megan Cassidy
1,308 Points
<!DOCTYPE html>

<html lang="en">
    <head>
        <meta charset="utf-8">
            <title>My Page</title>
    </head>
    <body>
        <p>
Whose woods these are I think I know.   
His house is in the village though;   
He will not see me stopping here   
To watch his woods fill up with snow.   

My little horse must think it queer   
To stop without a farmhouse near   
Between the woods and frozen lake   
The darkest evening of the year.   

He gives his harness bells a shake   
To ask if there is some mistake.   
The only other sound’s the sweep   
Of easy wind and downy flake.   

The woods are lovely, dark and deep,   
But I have promises to keep,   
And miles to go before I sleep,   
And miles to go before I sleep. </p>
        <p></p>

    </body>




</html>

12 Answers

I was just about to say that. I have the same problem when writing MySQL. I changed the file to plain text and it worked just fine. I just do shift-command-T whenever I need to convert instead of setting the default.

Chris Dziewa
Chris Dziewa
17,781 Points

TextEdit as a default sets everything as a rich-text format. To change this, you have to go into your TextEdit preferences and change to use plain text as a default.

I'm sure I can help, but it would be most helpful if you posted your code. In some cases, it can be because you have a syntax error, such as an extra "<" or ">". Take a good look at your code. If you can't find the error, please paste the code here.

Your code is fine, and it shows up perfectly fine in my browser. With TextEdit, I presume you're on a Mac. What browser are you using? And how are you attempting to view the file? What steps are you following?

Megan Cassidy
Megan Cassidy
1,308 Points

Safari, then I attempted to open it in Chrome. I have been opening the page through the browser, but it doesn't seem to like that very much, nor when I click on the document.

I opened it in Safari, Firefox and Chrome with no trouble at all. By default, it should open in your default browser, so no worries about having to change file associations. I've been writing HTML for 20 years, so I'm not a newbie, but wow, I think I'm actually stumped. I'll keep giving this some thought. Maybe someone who is thinking outside the box will chime in.

I also cut and pasted the code into Dreamweaver and it's fine.

Megan Cassidy
Megan Cassidy
1,308 Points

Thank you so much for trying! I'm currently exploring the preferences of TextEdit, trying to see if that has anything to do with preventing me from seeing it correctly.

Ah, see, that's thinking outside the box. I don't use TextEdit to write code. Look at the dialogue box settings when you save it. Try cutting and pasting into a new document and saving it again. Make sure you save it as a text document. I believe that's an option.

Actually you can save it as a .html document, so you should be fine there.

Megan Cassidy
Megan Cassidy
1,308 Points

Thank you both so much! That did the trick! (^_^)

Robert Bojor
PLUS
Robert Bojor
Courses Plus Student 29,439 Points

Why not trying to use something like SublimeText, which is free by the way, to edit html and php? It eliminates the need to Save As all the time or switching document types and it works like a charm on Mac - the only downside is that it will ask you to buy every 10 saves or so, just hit cancel and carry on.