199: HTML: How To: Simple Formatting.

Take Up Code - A podcast by Take Up Code: build your own computer games, apps, and robotics with podcasts and live classes

Categories:

You’ll learn how to use HTML to format your text into headings, paragraphs, and lists in this episode. Why do you need HTML to format your documents? Why not just use a text editor to write whatever you want to appear on a web page and save it in a plain text file? Will this work? And what problems will you encounter if you try this? First of all, it will work. Sort of. You can create content that you want to display and put that content on a web server. With a text file, you’ll be able to display separate paragraphs of text and you can even use tabs to indent some text. That’s about all the formatting you can do. Want a section break between topics? Well, you can always type in a bunch of dashes or maybe equal signs if you want to be extra fancy. Want a bulleted list of items? Well, you can always start each paragraph with a star character. That sort of looks like a bullet point, right? Want different sizes of text? Different colors? Different placement? Want links so visitors can navigate to other pages? Sorry, the browser just won’t interpret your text file like this. You’ll need to use HTML to add formatting and you can listen to the full episode to learn how to format headings, paragraphs, and lists. You can also read the full transcript below. Transcript Why do you need HTML to format your documents? Why not just use a text editor to write whatever you want to appear on a web page and save it in a plain text file? Will this work? And what problems will you encounter if you try this? First of all, it will work. Sort of. You can create content that you want to display and put that content on a web server. The web server doesn’t care or know anything about the content. Or, I should say that it doesn’t have to know anything about the content. Sometimes, you do want the web server to get involved and open your files and change them around before sending them to a browser when requested. I’ll explain when this is useful in a future episode. You have to remember that the way the World Wide Web works is on demand. Servers, don’t just start sending you web pages on their own. You have to first open a browser and visit a web page. Visiting a web page really just means that your browser makes a request for a file from a server at a particular URL and then displays the contents of the requested file once it arrives. Listen to episode 156 for more information about URLs. When your browser receives a file, it has to know what to do with that file. And for some types of files, it will have no idea what to do with them. The only thing a browser can do with a file type that it doesn’t recognize is to offer to save it on your local computer for you. Who knows, maybe you have another application that can make some sense of the file and open it. All the browsers I’ve seen know how to open and display simple text files. And most can even go as far as opening PDF files. A PDF file is a common and popular way to save your files so they can be opened by other people who may not have the same application used to create the file. Browsers can also display image files. They do this all the time anyway when images are placed inside web pages so it makes sense that a browser should also be able to display an image file directly. So if you wanted to, you could save your information that you want to present to the world as a plain text file, or as a PDF, or as an image. Images don’t have to be things you take with a camera. Just think about all the small text based images you see on Facebook. Let’s go over these options to see why HTML might not be such a bad option after all even if it does have a lot of strange angle brackets all over the place. First of all is expectation. People just expect HTML files when visiting a web page. If you instead provide just text files, then your page will look very strange. You’ll be able to display separate paragraphs of text and yo