previewing web pages in Safari

Joined
Jun 28, 2008
Messages
5
Reaction score
0
Points
1
I am a beginner and I just bought a html book to get started. (Elizaeth Castro, 'visual quickstart guide' 6.ed). I have created a web page using TextEdit and have saved the file as .html. When I open the file in Safari the page will not display as a web page but only shows me the html code. I'm hoping to build upon this modest start but am stuck already.
Here's what I've got so far.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
>
> <head>
> <meta-equiv="content-type" content="text/html; charset=utf-8"/>
> <title>
> My Title
> </title>
> </head>
>
> <body>
> <h1>Interests</h1>
> <p>Likes to play guitar and sing.</p>
> <h2>Favorite Guitar</h2>
> <p>My favorite guitar is an early seventies Les Paul.</p>
> </body>
> </html>

Thanks for any help,

Paperclip
 
Joined
Oct 22, 2007
Messages
8,967
Reaction score
287
Points
83
Location
London
Your Mac's Specs
Mac Mini Core i7 2012 | White 2009 MacBook 2 Ghz | 733 Mhz G4 Quicksilver
It works fine if you take all those > from the beginnings of each line
 
Joined
Jan 12, 2008
Messages
1,760
Reaction score
23
Points
38
Location
Leicester, England
Your Mac's Specs
MacBook, iPod Classic, 8GB 3G iPhone, Time Capsule
I think I had to save as .htm to make it display properly...
 
OP
P
Joined
Jun 28, 2008
Messages
5
Reaction score
0
Points
1
safari still won't preview my web page

Thanks Louishen and Skaheadpunk for your response. I feel encouraged that the code works on your browsers. I removed the > from the beginning of each line but it still does not work. (Those > signs must have got put there by TextEdit when I copied and pasted the file as I did not put them when I wrote the html.) TextEdit will not let me save the file as htm - only html.
I'm open to suggestions.

Paperclip
 
Joined
Jan 12, 2008
Messages
1,760
Reaction score
23
Points
38
Location
Leicester, England
Your Mac's Specs
MacBook, iPod Classic, 8GB 3G iPhone, Time Capsule
When you go to save as and type the filename, whack .htm on the end, then it asks you which extension you want to use, stick with .htm. Works for me!
 
OP
P
Joined
Jun 28, 2008
Messages
5
Reaction score
0
Points
1
previewing web pages in safari with .htm

Thanks for your help Skaheadpunk. TextEdit does not want me to save the file with an htm extension. I get an error window that only allows html or the use of both htm and html like this .htm.html. I saved the file with both extensions and then removed the html at the end. Safari still won't display the page as a web page.
I then saved the file in MS word 2004, with the file extension htm. I used both the 'save as' and 'save as a web page' options and tried both. Safari will not dispay the file as a web page. I'm really stumped.


Paperclip
 
Joined
Jul 22, 2008
Messages
8
Reaction score
1
Points
3
Location
Brecon, Wales
textedit options

Hi Paperclip
I had the same problem. This is what solved it:
Go into Textedit preferences
Select 'Plain text' in the Format section.
Close and restart Textedit
Copy and paste your original text into a new document in textedit
Select save as and put filename.html into the top box
in the dialogue box accept .html as the extension

the file then displayed correctly in Safari for me when i opened it. hope this helps
Moe
 
Joined
May 31, 2007
Messages
926
Reaction score
37
Points
28
Location
Ontario, Canada.
Your Mac's Specs
Macbook(W) 2GHz, 80GB HD, 1G RAM, Windows XP
follow the above post. when textedit is in richtext mode is has a neat feature (that always tends to trip up people learning to code html in it) but you can create a normal document, and save it as html to view on the web without having to write your own code. but as stated above, if you change it to plain text, you should find yourself having no problems.
 
Joined
Jul 22, 2008
Messages
8
Reaction score
1
Points
3
Location
Brecon, Wales
and a bit more...

yes further to all two previous posts, if you go to the 'Open and Save' tab under TextEdit preferences and check the 'Ignore rich text commands in html files' as well, the page should load correctly in a web browser but appear as editable text in TextEdit.
 
OP
P
Joined
Jun 28, 2008
Messages
5
Reaction score
0
Points
1
safari now previews my web page

Thanks Moe for your suggestion. Your solution worked. Thanks to all who contributed to this post.

Paperclip
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top