Resources

What does HTML & CSS stand for?

HTML stands for hypertext markup language, the language used to produce documents for the World Wide Web. Using tags and attributes, HTML tells Web browsers how to display the text, hyperlinks and images on a Web page, as well as how the page should respond when a user interacts with it. HTML pages are typically distributed on the Web using hypertext transfer protocol. HTML pages almost always use the ".htm" or ".html" file extension.


CSS (cascading style sheet) file allows you to separate your web sites HTML content from it's style. As always you use your HTML file to arrange the content, but all of the presentation (fonts, colors, background, borders, text formatting, link effects & so on...) are accomplished within a CSS.

First we will explore the internal method. This way you are simply placing the CSS code within the <head></head> tags of each HTML file you want to style with the CSS. The format for this is shown in the example below.

<head>
<title><title>
<style type="text/css">
CSS Content Goes Here
</style>
</head>
<body>

With this method each HTML file contains the CSS code needed to style the page. Meaning that any changes you want to make to one page, will have to be made to all. This method can be good if you need to style only one page, or if you want different pages to have varying styles.

Divisions are a block level HTML element used to define sections of an HTML file. A division can contain all the parts that make up your website. Including additional divisions, spans, images, text and so on.

You define a division within an HTML file by placing the following between the <body></body> tags:

<div>
Site contents go here
</div>

Though most likely you will want to add some style to it. You can do that in the following fashion:

<div id="container">
Site contents go here
</div>

The CSS file contains this:

#container{
  width: 70%;
  margin: auto;
  padding: 20px;
  border: 1px solid #666;
  background: #ffffff;
}

Now everything within that division will be styled by the "container" style rule, I defined within my CSS file. A division creates a linebreak by default. You can use both classes and IDs with a division tag to style sections of your website.

The class selector allows you to style items within the same HTML element differently. Similiar to what I mentioned in the introduction about inline styles. Except with classes the style can be overwritten by changing out stylesheets. You can use the same class selector again and again within an HTML file.

To put it more simply, this sentence you are reading is defined in my CSS file with the following.

p {
  font-size: small;
  color: #333333
}

Pretty simple, but lets say that I wanted to change the word "sentence" to green bold text, while leaving the rest of the sentence untouched. I would do the following to my HTML file.

<p>
To put it more simply, this <span class="greenboldtext">sentence</span> you are reading is styled in my CSS file by the following.
</p>

Then in my CSS file I would add this style selector:

.greenboldtext{
  font-size: small;
  color: #008080;
  font-weight: bold;
}

IDs are similar to classes, except once a specific id has been declared it cannot be used again within the same HTML file.

I generally use IDs to style the layout elements of a page that will only be needed once, whereas I use classes to style text and such that may be declared multiple times.

The main container for this page is defined by the following.

<div id="container">
Everything within my document is inside this division.
</div>

I have chosen the id selector for the "container" division over a class, because I only need to use it one time within this file.

Then in my CSS file I have the following:

#container{
  width: 80%;
  margin: auto;
  padding: 20px;
  border: 1px solid #666;
  background: #ffffff;
}

You will notice that the id selector begins with a (#) number sign instead of a (.) period, as the class selector does.