Why doesn't my browser render my code?


#1

So I have just recently started learning HTML and JS. However, when I tried to type my code in TextEdit, at the beginning, it rendered all of the tags, as shown. I would type this:

<!DOCTYPE> <html> </html>

Then the browser would render it like this:

<!DOCTYPE> <html> </html>

Then I read on a forum to change to text style to rough instead of rich, and it worked. However, I have started work on my website, and I saved it and closed it. Now when I open it in TexteEdit again, all the tags have disappeared, and when I try to add more code, like the <a> tag and it renders the tags in the browser. Any help is much appreciated. Thanks!


#2

the doctype declaration should be <!DOCTYPE html>

HTML (HyperText Markup Language) is the most basic building block of the Web. It describes and defines the content of a webpage

elements you add are only to structure the page, the user visiting your website shouldn’t see them. For example if you create a paragraph in textEdit:

<p>hello world!</p>

the browser should render:

hello world!

the paragraph element shouldn’t show on the webpage, its only to structure your page.

Where is the problem? In textEdit or the browser? If the tags are going in textEdit, something went wrong with saving the file or opening the correct file again later


#3

I am not sure. When I opened TextEdit, all the tags I had typed were gone, it was just the text, no tags. But when I added more tags, they displayed in the browser.


#4

textEdit doesn’t seem to be designed for making html files, i really recommend you to install something which can handle html files properly. Use Atom for example (link)


#5

Ok. Thank you. Appreciate this. I will look into this. Are Cloud9 and Brackets also good? I have heard of these too.


#6

cloud9 might be good, but its a website on which you can run code, its not a text-editor or IDE you can install.

Brackets and Atom are both good open source text-editors


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.