How do i save textedit as html on mac?

I'm brand new to html so please bear with me... I am trying to use textedit on mac to write html but it wont appear properly in chrome when I open the file.

I typed the following into text edit, saved as index.html file then when I open with chrome it appears exactly as it has been written with all the tags showing...what am I doing wrong? The code is a straight copy from W3schools so I'm pretty sure there is nothing wrong with the code so must be the way I am managing the files.

<!DOCTYPE html>
<html>
    <body>

        <h2>My First Heading</h2>

        <p>My first paragraph.</p>

    </body>
</html>

j08691

200k31 gold badges252 silver badges267 bronze badges

asked Feb 24, 2020 at 21:57

2

TextEdit is a basic, yet useful word processor and text editor that is bundled with macOS on the Apple Mac, but do you use it for HTML and code editing? It can be used with a few tweaks.

Do you use TextEdit or is it too basic for your needs? I certainly would not recommend it for serious code editing, but if you find yourself on another Mac at work or at a friend's home, it may be all you have. I would normally use Brackets or BBEdit, see Best web development tools for the Apple Mac.

It can sometimes be frustrating to use, such as when you try to edit an HTML file to make some quick changes to a website or web page, which after all is just plain text. TextEdit can modify the code and this can seriously mess up any HTML file edited with it, but there is a quick and easy solution to the problem.

Let's see an HTML file loaded into TextEdit with the default settings.

How do i save textedit as html on mac?

There are no images, so it is not quite wysiwyg but it does a reasonable job of displaying the text correctly and titles, bullet lists and paragraph text are all correctly displayed. The problem is thar if anything is edited and the file saved, it could add some code that is not allowed in HTML and that could ruin the page.

If you Ctrl+click on a .html file in a Finder window and select Open With, TextEdit.app, TextEdit opens and displays the file. However, it goes through a conversion process and in the page looks slightly different in the TextEdit window.

What's more, when you save the file after making changes, it rewrites the code in its own way and this is unlikely to be the way you want it. It adds lots of CSS code of its own, modifying what was already there. This could, in fact, break certain features in your website. It converts the .html file to a .rtfd file in the process.

TextEdit preferences

These problems can easily be solved and TexEdit can be turned into an HTML editor that could be used if nothing else is available with a few changes to the preferences.

What you must do is open TextEdit in the Applications folder and go to TextEdit, Preferences. On the New Document tab you might want to select plain text as the default format. This means that whenever you create a new file, TextEdit won't mess with the text. What you see is what you get. This is only for new files and the Format setting does not affect opening existing files.

How do i save textedit as html on mac?

Down at the bottom you might want to turn off spelling and grammar checking because HTML code does not follow the normal rules. It does no harm, but you will see a lot of red wiggly underlines that are annoying.

Tick the checkbox Smart quotes and dashes in rich text documents only. You don't want TextEdit changing anything.

Select the Open and Save tab and then tick the box at the top - Display HTML files as HTML code instead of formatted text. You should also clear the tick against Add ".txt" extension to plain text files.

How do i save textedit as html on mac?

After making these changes find a .html file on the Mac's disk drive, right click it and select Open With, TextEdit.app and it now simply shows the plain text like this:

How do i save textedit as html on mac?

This alternative editing mode does not mess around with the HTML or CSS code and it makes Text Edit useful for quick and dirty changes to web pages that are on the disk drive. It does not convert HTML and it saves files back out as .html files.

Why is my HTML showing up as text?

Show activity on this post. This HTML isn't being interpreted as plain text: it's being interpreted as HTML. It's just that the contents of your HTML include markup that has been escaped, such as &lt; and &gt; .

Does Mac have an HTML editor?

The TextEdit program ships with all Mac computers. With it, and a knowledge of HTML, you can write and edit HTML code. TextEdit, which works with files in a rich text format by default, must be in plain text mode to write or edit HTML.

How do I save a HTML File?

Choose File > Save As and choose HTML from the drop-down list. Give the filename an extension of . html, specify the file location, and click Save. The converted file is saved where you specified.

How do I get HTML code on Mac?

How to view the HTML source code of a website on a Mac. To view the source of a website on a Mac using Safari, navigate to the page you want and use the following keyboard shortcut: Option+Command+U. Alternatively, you can right-click anywhere on the page and select “Show Page Source” from the dropdown menu.