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 trialPauline Faure
Courses Plus Student 749 PointsHTML : My text edit file doesn't open up to an actual webpage
So I created an html page with TextEdit on my mac saving it at an HTML file, however when I click on it, to open it with safari, the all coding appears on my web page:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title> My page </title>
</head>
<body>
<p>
Lorem blabla
</p>
</body>
</html>
Normally i should be able to only see the title My page and Lorem blabla.
But it's not the case at all (you can check out what i see by copy pasting this: file:///Users/paulinefaure/Desktop/Index%20copy.html
What should I do?
5 Answers
Lee Stetson
16,944 PointsHi Pauline,
Make sure you have closed all of your HTML tags. If you need help, you can use Markdown here to display your code and we can help review it. (Use the 3 backticks around your code to display it inline as code, as the Markdown Cheatsheet shows.)
We won't be able to see what you see with your link. That link indicates a file stored locally on your computer.
Jason Anello
Courses Plus Student 94,610 PointsHi Pauline,
TextEdit is a word processor and needs to be configured to work with text files.
I would recommend that you switch to a text editor like sublime text or do a search for "mac text editor" for more options.
Brenton Kelly
1,058 PointsHi Pauline, Unfortunately, I can't see your HTML file as it's local to your machine and not on a public web server. I noticed that you are using Text Edit on a Mac. I use this from time to time as well! My best and initial guess stems from this answer I came across on stack overflow. (http://stackoverflow.com/questions/6758706/why-isnt-html-rendering-on-my-web-browser) It would be a good idea to make sure that you are producing your files in "Plain Text". To check this in Text Edit, click Text Edit in the top menu bar and then Preferences. Click the "Plain Text" radio button and then create your file.
I hope this helps! Brenton
Lucas Krause
19,924 PointsTo correct some previous responses: You can open local HTML files in Safari and they should be interpreted and displayed correctly.
As some other users advised, I also would recommend you to use a text editor primarily developed for editing code. When using TextEdit there are two ways to write your markup properly:
- Under TextEdit > Preferences: New Document: Format select the radio "Plain Text". Then create a new document.
- Simply create a new document regardless of your preferences. After that click Format > Convert to plain text (or simply hit
[cmd]+[shift]+[t]
).
Write your code into the newly created file (plain text) and save it with the file extension ".html".You can open this file in Safari or any other web browser properly.
Joseph Alejandro
1,428 PointsActually, to see the website you will need to host it online because its saved locally on your mac. Can you post whats inside of your html file here to see exactly whats wrong? Also make sure you save your file as name_of_file.html
Jahaziel Vazquez
112 PointsJahaziel Vazquez
112 PointsI Know why!
you need to convert your file on text edit, to simple instead of rich text. You do this by going to format, and looking for the simple text format, and select it. Then when you save the file, next to what ever name you use for it put .html and de-selecting the option that says that it'll automatically be a txt file if nothing else is selected.
Then if you want to view it on you web page, go to your file and select open with, and select whatever browser you use. Then you can just edit your code at will and save it and refresh your page in order to view what it looks like.