I know this could be in a better place, but most beginners tend to post in this forum about issues not always relating to HTML/CSS.
The Differences
HTML - HyperText Mark-up Language:
Basically, this tells a browser
what to display and
how to display it. It also, more importantly, tells the browser how links are made, so that pages can be linked together.
HTML can say which FONT to use, however it
can't give the user that font.
It
can't process information (as in a sign-up form), it can only hold the information. To process the information, you need to use something called server-side scripting. Such a scripting language is PHP.
CSS - Cascading StyleSheets:
CSS is used to style the data presentation. This includes font formatting, page layout and structure. CSS is also used to control non-visual elements, such as pitch on screen readers.
CSS can even be used to add data into your HTML document, however this is only primitive and only advisable in certain conditions. CSS can not be used to link pages together or to put pages into other pages. HTML should not occur within CSS. PHP can though, only if it occurs within the HTML. E.g. HTML contains a segment of CSS. The segment of CSS contains PHP to do something that neither the HTML or the CSS can do.
PHP - Hypertext PreProcessor:
The letters might be in the wrong order for the acronym, but that's what it stands for.
Quote:
|
Originally Posted by http://gtk.php.net/manual1/it/html/intro.whatis.php.whatdoes.html
PHP is a general purpose language. It is normally put to use as an html-embedded scripting language for use on the web, but it can also be used as a shell scripting language or even as a language to write windowed applications, in the form of PHP-GTK.
Due to PHP's open-source nature, if there is something you can't currently do in PHP itself there is nothing stopping you from writing a PHP module or extension in C code to extend its functionality so that you can do what you want from within PHP itself. This is made possible through the well-documented API which is available to all.
|
Example Uses
The following will give a paragraph blue color.
HTML Code:
<p style="color: #0000ff;">This is blue</p>
CSS can be added to HTML in three ways.
- Between the <style type="text/css"></style> between <head></head>
- <link rel="stylesheet" type="text/css" title="your stylesheet" href="stylesheet.css">
- <tag style="property: value;"></tag>
The first method can be used in junction with PHP. For example, say you wanted all files to come from a certain directory at a certain site (not yours). You would combine PHP and CSS to make the job quicker and easier.
HTML Code:
<?php
// URL of folder (directory)
$urlOfDir = "http://www.yourdomain.com/dir-one/dir-two/";
?>
<style type="text/css">
body{
background-image: url(<?php echo $urlOfDir; ?>image.jpg);
}
</style>
The URL of the constantly used folder is held as $urlOfDir. Then, using simple PHP (echo) to produce that link. This of course depends on whether your server supports PHP.
Combining all three languages(?) can prove to be quite powerful. What do you think powers these forums (fundamentals)?