The Relationship Between HTML, CSS and JavaScript Explained

HTML, PHP, Javascript, and CSS are all web technologies, and it may be a little difficult to distinguish the differences and the role of all these languages.

As a first step, it is essential to understand that not all these technics are competitors; they are designed to work together.

But Then What Differentiates Them?

To understand, you need to know how a website works.

Client / Server

It all starts in the address bar of a web browser (like Firefox or Chrome): when you type a URL, the browser will ask the page you are looking for from the web server that hosts it via the HTTP protocol.

In jargon, said he’s sending an HTTP request. That’S what an HTTP request looks like. :

Now let’s see what’s going on at the other end of the line, on the server.

The machine will receive the HTTP request thanks to a program that runs continuously and is dedicated to this function: wait for the HTTP requests that might arrive (on port 80), and respond to them.

This program is usually Apache, the most used HTTP server in the world.

Apache will read the HTTP request that your browser just sent it, and it will respond to it. An HTTP response consists of a series of headers, followed by the body, which can be the HTML code of a web page.

This is, for example, the beginning of the answer to the above query (there is not everything, the answer is very long).

Then it’s not over. The browser will analyze the server response. It will interpret all this to do the rendering of the web page, what you see on the screen (because in case you haven’t noticed, when you visit a website you don’t see its HTML code, you see the result of this HTML code : page layout, text, images, animations).

You now know that a web site is a communication between your browser, which is called the client, and a server. This notion of client/server is fundamental; it is the basis of the web.

Now that this is all settled, we can get right to the point.

If you want to know more, it is here: validation of the value of an excel cell.

Everyone’s Place in the Chain

PHP is a server-side language that generates web pages on the fly rather than serving static web pages. In fact, when we look at what happens on the web server of a site using PHP, it is always Apache who takes care of receiving HTTP requests that come from the internet, but he will then delegate the response to this request to a program called PHP, and who will be responsible for generating the headers and the HTML (body) code that will be returned to the client.

Conversely, HTML / CSS and Javascript are all client-side languages; they are executed on the browser.

HTML / CSS are complementary: HTML is a tag language used to define the semantic structure of a web page: its menus, its text blocks, its images… while CSS allows determining how all these elements are displayed on the screen: text color, margins, borders, background images.

The browser uses HTML code and CSS style Sheets to render to the screen.

HTML and CSS are not strictly speaking programming languages; we must see it more as a word processor (like Word) not very user-friendly but also very powerful (look at the diversity of websites to realize the possibilities they offer).

But that’s not all, there is better: Javascript is when it has a real programming language, which allows making the web pages interactive. Javascript allows you to change a web page without using the server.

This allows you to modify the elements in a form, create animations, display error messages when filling out a form, and many other things.

Send a Message