Home > Basic HTML Codes > Basic HTML code of Mac?

Basic HTML code of Mac?

I just purchased a Macbook Laptop. I’m trying to save my very basic lines of code in Textedit, but even when I save it as .html, it shows up in both safari and firefox just displaying the code, not the way I formatted it in the html coding. Following is the code:

<html>
<head></head>
<title>Web</title>
<body> Hello </body>
</html>

when i open the document in firefox, it simply reads code for code, rather than just "hello". What am i doing wrong?

Basic HTML Codes , , , , , ,

  1. Kevin
    February 7th, 2010 at 01:58 | #1

    Try using this code to do that then.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Web</title>
    </head>

    <body>Hello
    </body>
    </html>

    It seems to me that your title tag there should be within the head and you should also always declare the DTD as well.

  2. trekkiemage
    February 7th, 2010 at 01:58 | #2

    I tried it and didn’t have an issue. The only thing I did differently is added an <h1></h1> tag around ‘Hello’.

    Is the icon for the file a small page with a Safari image?

  3. JavaScript_Junkie
    February 7th, 2010 at 01:58 | #3

    John
    goto properties and save as properties to IE

  4. Ian A
    February 7th, 2010 at 01:58 | #4

    On the save screen did you choose ALL FIiles? Not textedit files? Just a guess as I have no clue about macs but I think it will help :)

  5. Oz
    February 7th, 2010 at 01:58 | #5

    Maybe you’re Saving the document wrong.

    I just ran your code and it works.

    Clue: You have to use a text editor to format the extension. It’s not a word processor format. You probably have the option to Save As a text document. That’s what you need.

    Save as html.html

    Works.

  1. No trackbacks yet.