Jump to content

Humble beginner needs help!


micthomp
 Share

Recommended Posts

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 by micthomp
Link to comment
Share on other sites

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 Heading

My first paragraph.

 


Hope this helps...

Edited by scout1idf
Link to comment
Share on other sites

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 by davej
  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...