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 Introduction Global Structure: Part 2

Wang Lei
Wang Lei
2,766 Points

My index.html is not displaying correctly when opened in a browser.

Following the video, I created my own 'index.html' using text-editor on my Mac. (OS X). I key in the basic codes below: <!DOCTYPE html> <html lang=“en”> <head> <meta charset=“utf-8”> <title>My Page</title> </head> </html> Unfornately when I save the index.html doc. and open it with Safari browser. I see the save code instead of the idea one: one blank page with "My Page" on the tag.

Could you please give me some help? Thanks.

7 Answers

Erik Nuber
Erik Nuber
20,629 Points

replace your meta tag with this...

<meta http-equiv="Content-Type" content="text/html"; charset="UTF-8" />

I also believe you have to have a minimum amount of tags to have a page work properly and with what you have written above there is no body tag.

<!DOCTYPE html>
<html>
<head> <title></title></head>
<body></body>
</html>
Wang Lei
Wang Lei
2,766 Points

Problem not solved

Wang Lei
Wang Lei
2,766 Points

The problem is not solved. I see the same content in web browser too. It's interesting that it's OK when I use Win7 OS and IE browser.

Erik Nuber
Erik Nuber
20,629 Points

Could you please take a snapshot of your workspace if that is what you are using. It is the little camera icon on right top side of the screen, it will allow you to share your work. There isn't enough info here to know what the actual issue is.

If not, if you could paste your code. To share that properly please use the little tick mark found under the tidle key next to the one key on the keyboard. You have to put three of those marks both above and below your code to get it into the black box like my code above shows.

Wang Lei
Wang Lei
2,766 Points

Sorry my problem is not solved

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

Wang Lei

Sorry this isn't working for you. We need some more help from you in order to understand what's going wrong. Can yo provide your complete code or a link to a Workspaces snapshot?

Hi Please someone, help me out with this very big issue. I cannot open my files anymore because they all indicate that the file type is png file or DS store and I don’t know how that happened although I save all my files as index.html. It just happened soundainly on many of my files I saved either on the PC or an external memory.
The big issue is the same for pictures.

Wang Lei
Wang Lei
2,766 Points

<!DOCTYPE html>

<html lang=“en”> <head> <meta http-equiv=“Content-Type” content=“text/html”; charset=“UTF-8” /> <title>My Page</title> </head> </html>

By the way, I change the <meta> code according to previous suggestion, but unfortunately it doesn't work. I write the same code on another laptop with Win7 OS, the code works correctly in IE or Chrome browser.

Erik Nuber
Erik Nuber
20,629 Points

Is this your entire code? Could you please share if there is more.

Here is your Code

<!DOCTYPE html>
<html lang=“en”> 
<head> 
        <meta http-equiv=“Content-Type” content=“text/html”; charset=“UTF-8” />
        <title>My Page</title>
 </head> 
</html>

minimal code

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>title</title>
    <link rel="stylesheet" href="style.css"> <!--if css file attached -->
    <script src="script.js"></script> <!--if js file attached-->
  </head>
  <body>
    <!-- page content --> 
  </body>
</html>

However, I did read on another site that you could be even more minimal than this....

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<title>HTML4 Minimal Markup Example</title>


<!doctype html>
<title>HTML5 Minimal Markup Example</title>
Wang Lei
Wang Lei
2,766 Points

I will try to copy a longer code from my Win7 PC to MAC and check if it is working or not.