WebProgramming Academy

Chapter One: Introduction to CSS

CSS (Cascade Style Sheet) is a programming language that interacts with HTML elements to be displayed in a style. HTML only displays content on to the web browser but if you want to add color onto the text or alter the text font, CSS coding will be needed. It is possible to code the coloring and font size in HTML however it will take too long for up scaled large website to be modified. CSS take advantage of putting all the code into one file and display style to all HTML files.

Internal CSS

If you plan to hard code in HTML, you will need to tell the HTML file that there will be CSS codes implmented into the HTML file. In the HTML tutorial we discussed about the Heading element which gives a description of the HTML file. We will write our CSS code inside the Heading element using the sub-element style.

External CSS

External CSS is a separate file that styles the HTML file. It is similar to internal CSS with the exception of having an additional file. The external CSS file does not require you to insert the style element however in the HTML file where the heading content is.

It is necessary because it links the two files together. Once you have completed that. In the CSS document, you can write all the CSS code into the document to style the HTML file. Similar to HTML, .css is a necessary extension for the file name because it tells the web browser that this is a CSS file.

CSS syntax

  • H1 is the selector
  • color:blue is a declaration
  • color is the property
  • blue is the value
  • font-size is the property
  • 12 is the value