micthomp Posted September 11, 2013 Share Posted September 11, 2013 (edited) So I just started teaching myself HTML and I am wondering why my browser won't display this very simple web document. I opened with Google Chrome web browser and it displayed it exactly as it looks below, instead of translating it into a web page. Here is the HTML code I created in TextEdit. I saved it as an HTML doc. <!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html> I also attached file to this post.my first first website.html What am I doing wrong? Edited September 11, 2013 by micthomp Link to comment Share on other sites More sharing options...
scout1idf Posted September 11, 2013 Share Posted September 11, 2013 (edited) The code you are using...... <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Style-Type" content="text/css"> <title></title> <meta name="Generator" content="Cocoa HTML Writer"> <meta name="CocoaVersion" content="1038.36"> <style type="text/css"> p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px} </style></head><body><p class="p1"><!DOCTYPE html></p><p class="p1"><html></p><p class="p1"><body></p><p class="p2"><br></p><p class="p1"><h1>My First Heading</h1></p><p class="p2"><br></p><p class="p1"><p>My first paragraph.</p></p><p class="p2"><br></p><p class="p1"></body></p><p class="p1"></html></p></body></html> .......will give you... <!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html> To show the page you want to see, minus the styling, you need to use this code..... <!DOCTYPE html><html><head> <title>my first first website</title></head><body> <h1>My First Heading</h1> <p>My first paragraph.</p></body></html> ...... to give you.... My First HeadingMy first paragraph. Hope this helps... Edited September 11, 2013 by scout1idf Link to comment Share on other sites More sharing options...
davej Posted September 11, 2013 Share Posted September 11, 2013 (edited) I think the problem is the TextEdit setup needs adjusting. See... http://support.apple.com/kb/TA20406 The code you produced is this... <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="Content-Style-Type" content="text/css"><title></title><meta name="Generator" content="Cocoa HTML Writer"><meta name="CocoaVersion" content="1038.36"><style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px} </style></head><body><p class="p1"><!DOCTYPE html></p><p class="p1"><html></p><p class="p1"><body></p><p class="p2"><br></p><p class="p1"><h1>My First Heading</h1></p><p class="p2"><br></p><p class="p1"><p>My first paragraph.</p></p><p class="p2"><br></p><p class="p1"></body></p><p class="p1"></html></p></body></html> Instead try this... <!DOCTYPE html><html><head><meta charset="utf-8"><title>My Title</title><style>body{background-color: #bbb;}.red {color: red;}.green{color: green;}</style></head><body><h1>This is my web page</h1><p>This is a paragraph</p><p class="red">This is a paragraph</p><p class="green">This is a paragraph</p><form><label>Name:<input type="text"/></label><input type="submit" value="Submit"/></form><hr/><a href="http://www.w3schools.com/html/html5_intro.asp">HTML Tutorial</a></body></html> Edited September 11, 2013 by davej 1 Link to comment Share on other sites More sharing options...
micthomp Posted September 13, 2013 Author Share Posted September 13, 2013 You're right davej! The TextEdit settings needed to be adjusted. Now it works flawlessly! Thanks guys for the help! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now