From the course: HTML Essential Training

The role of HTML - HTML Tutorial

From the course: HTML Essential Training

Start my 1-month free trial

The role of HTML

- The Web is made out of three programming languages, HTML, CSS and Javascript. HTML stands for HyperText Markup Language. HTML marks up the content of a site. Basically it tells the user's computer what things are. It also provides access to an incredible amount of functionality that's already built directly into the browser. You can call up that functionality through using certain HTML. CSS stands for Cascading Style Sheets. CSS provides visual styling and layout for everything on the web page. It makes each web page look the way that it looks, color, typography and size. And we can add simply animations and interactions through CSS. JavaScript is a programming language that provides the ability to create more powerful interactivity. The more complex and rich an interface becomes, the more likely that JavaScript is used to make that experience seamless for the site's users. This can be confusing or frustrating for some coders. Why does the Web use multiple programming languages? Why can't we just have one? Well, the Web is different than other types of software. You can code a website today and expect that it will still work in five years or 10 years, without any updates. You can easily write your code so that it works on an old computer or an old browser from 10 years ago. The Web runs on Mac, Windows, iOS, Android, Linux, other mobile OS's, Ebook readers, game consoles, televisions, watches. There's a wide diversity of devices that run HTML, CSS and JavaScript in some form or fashion. That was the entire point of the Web, the reason it was invented. To provide a way for humanity to share content, even when our computers are different from each other. It's pretty remarkable. This is made possible by having three different kinds of programming languages, each doing part of the job. HTML is simple in its structure. There is no programming logic, no loops or functions. Instead, HTML is what's called a declarative language. The code simply declares, Hey, that's a paragraph! Hey, make this a link! Hey, put a form field right here! It's all vocabulary. It's all declarations. It's the simplicity in HTML that gives it its resilience and its robustness. If something is wrong with HTML, if something is missing or spelled wrong, HTML is like, eh, close enough. I'll just guess what they meant and fix it. I'll display this page anyway. HTML can take a lot of abuse and still deliver. CSS has a bit more logic to it. There's a bit more computer science structure there, which makes it a bit more fragile, and a bit more powerful. It does still have a tremendous amount of resilience. When something goes wrong in CSS, the browser will skip just that section of code and not apply that styling. But it will go on to apply the rest. It might not come out completely correct, the the browser will do its best and most of it will work. JavaScript is the most powerful. There are many things that JavaScript can do that HTML and CSS cannot do. But it's also the most fragile. If something's wrong with the code, or the browser is too old to know what that code means, the browser will stop. It gives up. It won't run that JavaScript. It doesn't want to start guessing what to do, which makes JavaScript more fragile. Having all three languages means that developers can combine these qualities. Resilience, robustness and power. It's quite remarkable. Do as much as possible in the more robust parts of the stack of these languages, and then use the rest of the stack to make the site better. If you can do something in HTML, then do it in HTML. If you can't, then use the other parts. All of this is to say that HTML is pretty great. It's worth taking the time to learn all the different HTML elements and attributes, so you can fully leverage what it has to offer.

Contents