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 trialPeter Downs
3,421 Pointslocalhost?
When I open my index.html file with the browser, I get all of the code. I don't get "This is a div." I feel like I missed a step, but can't figure out what it is. What am I missing?
Peter Downs
3,421 PointsHere's the code:
<!DOCTYPE html>
<html lang=βenβ> <head> <meta charset=βutf-8β> <title>My Page</title> </head> <body> <div>This is a div.</div> </body> </html>
Peter Downs
3,421 PointsTo put it another way, when I refresh localhost, it does not change to My Page.
David Lane
33,414 PointsWhat type of localhost are you running? When done in MAMP, your code produces a blank page that says "This is a div." with a title of "My Page".
Peter Downs
3,421 PointsI don't know. I'm just following the HTML tutorial: open localhost in chrome, create and save index.html, refresh localhost, and for me, nothing happens. I am using a mac. Do I need to set up, download, or switch on something? It is not covered in this track.
Peter Downs
3,421 PointsI think my next step will be a google search on setting up localhost on a mac running os x.
Justin Swatloski
5,769 PointsMaybe the problem comes from not having opening and closing <html> tags.
Try
<!DOCTYPE html>
<html>
(YOUR CODE)
</html>
Peter Downs
3,421 PointsNope, already has the opening and closing tags.
I found instructions online that recommended putting index.html into a Sites folder in Home, instead of on the desktop. Now, when I go to localhost it does go directly to index.html, but it still just displays the code instead of rendering a page according to the html in the code.
Tena Spoljar
13,783 PointsHi! I believe your problem could be that you don't have your index.html in the right directory, or even a web server like apache installed.
But you don't need that to start learning and testing html! Simply open that index.html file with a browser and everything should be working fine. At that point you can call your html what ever you like, as long as it has .html extension.
1 Answer
Peter Downs
3,421 PointsYeah, I used a browser to do it.
I'll check to see if updating my OS uninstalled Apache. I hadn't thought of that.
David Lane
33,414 PointsDavid Lane
33,414 PointsPlease post your code, we need to see your markup to figure out the problem.