ady_cole — 2011-07-21T16:15:48-04:00 — #1
I have copied the example text into Notepad but when I open in Firefox it does not display a webpage, just the HTML. What could I be doing wrong?
I am a complete beginner and no advice is too basic for me!
black_max — 2011-07-21T16:16:54-04:00 — #2
Welcome to SitePoint! You're in the right place for help.
Did you save it using the .html extension?
I can't be more specific because I don't have the book.
ady_cole — 2011-07-21T16:25:24-04:00 — #3
Thanks for swift reply!
Yes - I saved as basic.html and UFT-8 from the drop down (Plain Text Encoding) as the book says
ady_cole — 2011-07-21T16:27:41-04:00 — #4
this is the html I wrote:
<!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Strict//EN"
<title>The Most Basic Web Page in the World</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<h1>The Most Basic Web Page in the World</h1>
<p>This is the very simple web page to get you started. Hopefully you will get to see how the markup that drives the page relates to the end result that you can see on screen.</p>
<p>This is another paragraph, by the way. Just to show how it works.</p>
black_max — 2011-07-21T16:34:42-04:00 — #5
I was able to save and open it in Opera without difficulty. Hmmmm.
xhtmlcoder — 2011-07-22T07:04:25-04:00 — #6
You have three typos in your code:
Should be be written as follows:
<!DOCTYPE html PUBLIC "-//W3C/[B]<font color='Magenta'>/</font>[/B]DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD[B]<font color='Magenta'>/</font>[/B]xhtml<font color='Magenta'>[B]1[/B]</font>-strict.dtd">
I'll give you a tip for the DOCTYPE, i.e. this code sample in this post copy and paste a correct Doctype (those three lines) rather than typing it all by hand - not even I bother typing out that part in full... I've highlighted the 3 corrections too.
However, that won't effect it from rendering in Fx. thus most probable the reason you are seeing markup and not the actual webpage is probably because your file extension is still *.txt and not *.html You might have accidentally have a file called: basic.html.txt
One easy way to findout, is to look at the Firefox address bar URL and see if the file you load ends in *.html your file should be called basic.html and nothing else.
Double-check it has the *.html extension as sometimes people accidentally leave the extension *.txt in place on the end when is should be be *.html
ady_cole — 2011-07-22T10:18:45-04:00 — #7
You are right about the address bar as it does show a .txt but I am unable to save the file as anything else in Notepad. It offers a 'txt' file or an 'All files' option the all files optiion does not seem to do the trick. When searching for it it comes up as basic.html only but the address bar shows it ending in .txt as you predicted. How should I correct that?
rguy84 — 2011-07-22T10:45:19-04:00 — #8
You will need to show file extentsions in windows. Open any folder, click tools, folder options, view tab. A few options down, there will be hide known extentions - untick it. Hit apply. Right click your file, choose rename. Delete the .txt, and type .html, hit ok/yes to the prompt. open it FF
ady_cole — 2011-07-22T12:04:18-04:00 — #9
i have windows XP and i am unable to do as you suggest. there is no 'hide known extensions' check box. Is there another way do you think?
ady_cole — 2011-07-22T12:14:53-04:00 — #10
I have now saved the html scipt again in a new notepad document and i have finally achieved the result I was supposed to get.
Thank you all very much indeed for your advice that put me on the right track.
This is truely an amazing resource you all provide. (No doubt I will be back!)
Very much appreciated.
xhtmlcoder — 2011-07-22T14:42:55-04:00 — #11
No worries Ady, hundreds of people make that mistake regarding that book or for that matter a lot of beginners. When you get onto external CSS files around page  you do similar but save as *.css instead of the *.html extension.
black_max — 2011-07-23T01:44:07-04:00 — #12
Or use Notepad++ (free) that lets you save files as a bunch of different types, including HTML and CSS.
ady_cole — 2011-07-24T14:32:15-04:00 — #13
Top notch - thanks again!