What is html?

html is what we still think of when we think of web pages.  This is not because it’s the language that web servers speak, but instead it’s the language that your web browser knows.  This is common to every web browser.  Web browsers do not know php or Perl or Ruby or any of the other coding languages you can think of.  They understand html.

Every server you connect to on the web will send your browser html.  No matter what’s actually going on behind the scenes, html is the end result of what gets sent to your browser to draw or render a web page for you.  If the web page is coded in something other than html, the server has to do some extra work to generate html from that code and send that html to your browser.

So now you know what html is.  Html is a set of instructions that are sent to the web browser, to tell the browser exactly how it should render a specific web page.

html is a pretty simple language.  It uses various directives known as tags to get things done.  It’s easy to do very basic things in html.

First things first – when you code an html page, there are some basic requirements of what must be included so your browser can handle things properly without having a nervous breakdown.  Let’s take a look at the below html example –

<!DOCTYPE html>
 <html>
 </html>

What does this html do?  Well, it actually does absolutely nothing!  But, it’s the minimum required contents for an html page.

The first line <!DOCTYPE html>  tells the browser that this file contains html, and tells the browser which version of html it is.

The second line has the <html> tag, which tells the browser that everything that follows will be html code.

And the third line “closes” the html tag and thus tells the browser that this is the end of the html code being sent in this file.  Generally speaking, nothing should follow after the </html> tag, other than perhaps some comments for the coder.

This little do-nothing code snippet illustrates fundamentally how html works.  In html, everything that you want to do requires opening a tag and closing a tag.

If you want to tell html to display a font in bold, you use the <strong> tag, and you use it like this –

<strong>This will display in bold</strong>

The forward slash is always used to close a tag.

If you want some text to be displayed in html, you just include the text in our initial example –

<!DOCTYPE html>
 <html>
 CodingForBeginners is my favorite website
</html>

This will of course display the following –

CodingForBeginners.com is my favorite website

If we want to do something in particular with that text, we add tags around the text that give the browser some additional details of what to do.  Let’s say we want to make that text bold.  We just use the <strong> tag (followed of course by </strong>)

<!DOCTYPE html>
 <html>
 <strong>CodingForBeginners.com is my favorite website</strong>
</html>

See what we’ve done now?  We’ve told the browser that all of the text between <strong> and </strong> should be displayed in bold font.

What if we just want the website name only in bold?  Easy – just move the </strong> tag –

<!DOCTYPE html>
 <html>
 <strong>CodingForBeginners.com</strong> is my favorite website
</html>

Let’s take it just one step further and show you how a typical page would be structured in html.  Let’s look at the below code snippet –

<!DOCTYPE html>
<html>

<head>

</head>
<body>

CodingForBeginners.com is my favorite website

</body>
</html>

See that?  I’ll bet you’re already getting the hang of coding in html and you’ve barely even gotten started.  Just think of how much you’ll be able to do with some more learning.

Even though html is a “client side” language interpreted by a web browser, servers still need to store the html files so they can send them to your browser.  And the server needs an organized way to be able to differentiate between different types of files, so the most common convention is to name html files in the form of filename.html, so that there’s a .html at the end of the file.  Most servers also are okay with .htm, but we like .html since it’s most explicit and simple.

Another common convention is that the server will have a bunch of html files and it needs to know which one to send first when a website loads.  This is your index file which will be named index.html – but to make things confusing for all of us, there are other common conventions and sometimes it can be “default.html” – but again, we like what’s simplest and most common, and that’s index.html so we recommend you stick with that.

There are a few great places you can learn html much more thoroughly.  They are mentioned at the end of the html section.

So you see, html is a very simple language.  It’s just used to render web pages and that’s it.  It’s not smart enough to do anything beyond that.  It can’t even add or subtract.

 

Limitations of html

The main reason languages such as php exist is due to the limitations of html.  html has no actual computing or logic capabilities.  It just follows instructions line by line, but it can’t do some really important things like store data in a database, retrieve data from a database, loop repetitively through information, handle conditional logic so that it can handle certain scenarios one way and other scenarios a different way.  So, html is purely for rendering pages.  For anything more, we have to look to “smarter” languages like php.  Note that html pages can incorporate javascript, which will help provide some more advanced functionality.