I’m Dudley Storey, the author of Pro CSS3 Animation. This is my blog, where I talk about web design and development with , and . To receive more information, including news, updates, and tips, you should follow me on Twitter or add me on Google+.

web developer guide

my books

Book cover of Pro CSS3 AnimationPro CSS3 Animation, Apress, 2013

my other blogs

Massive Head Canon: Intelligent discussion of movies, books, games, and technology.

my projects

A Sass color keyword system for designers. Replaces CSS defaults with improved hues and more memorable, relevant color names.

CSSslidy: an auto-generated #RWD image slider. 3.8K of JS, no JQuery. Drop in images, add a line of CSS. Done.

tipster.ioAutomatically provides local tipping customs and percentages for services anywhere.

The Roles of HTML, CSS, PHP and JavaScript on Web Pages

php / introduction

Estimated reading time: 1 minute, 20 seconds

As it's common to write , , and together on the same page, it is very important to have a solid grasp of one language before the next is introduced. The general rules for utilizing all of these languages together are:

  1. Content that is static, unchanging and different for each page is written in HTML.

  2. Any content or interactivity that needs to be both dynamic and dependable is written in PHP, such as include() and date().

  3. Appearance and “light” interactivity is written in CSS.

  4. “Heavy” interactivity that needs to respond quickly but which may be considered optional is written in JavaScript.

  5. PHP, being interpreted by the server, is executed first; the result is then sent to the client, which reads the completed page from the top down.

These rules reflect the client-server relationship discussed earlier: server-side languages are slower but highly dependable; client side languages are quicker, but we have have few ways of knowing if they were interpreted correctly or not. Features that are absolutely required to work every time therefore tend to be written in a server-side language; features that are optional are client-side. This also tends to CSS: the user could, in theory, see your page with CSS turned off, and it should still be readable.

Note that these are not absolute rules: there is increasing fuzziness towards the edges of each language. For example, JavaScript can interact with a server via AJAX, and can increasingly be used to do what was only possible in JavaScript. But they suffice as general rules.

comments powered by Disqus

This site helps millions of visitors while remaining ad-free. For less than the price of a cup of coffee, you can help pay for bandwidth and server costs while encouraging further articles.