CSS is short for Cascading Style Sheets - words that strike fear into even the most experienced programmer's hearts. Behind the intimidating front of cryptic code and crafty syntax, is, in fact, a simple, effective code, that you can learn reasonably quickly. CSS defines how to display HTML elements, so your browser knows how to make a website look attractive and stylish. No website is complete without an appealing interface and user experience, and so CSS can make-or-break a site.
The original HTML was never designed to tell the browser how to display the web pages, only the content. CSS was added in HTML 4.0 to let browsers display web pages with a modern, attractive, and highly customisable feel to them.
With this handy reference, we'll show you the most important properties you'll use in CSS, helping you get the job done faster and more effectively.
Overview
The basic principle of CSS allows the designer to define a style: a list of formatting properties, like size, colour and font. CSS code is usually stored in .css files. By using external files, you can reference these in your HTML code, and change the look of an entire site easily. CSS is a powerful way of customising appearance.
CSS Areas
CSS works using several different areas:
These 6 CSS areas help you adjust the positions, sizes and contents of CSS areas in your page. The areas are also known as the ‘Box Model'.
Positioning
There are 13 different positioning keywords, to help you adjust the positions of elements on your page:
Use these to adjust the positions of items on your page. For example, setting top:-5px will move the top of an element 5 pixels above its relative location.
Dimensions
The dimensions properties let you set sizes for elements, such as images or text boxes.
Text
The text properties let you specify ways of adjusting text. You can indent, align, transform and adjusts heights of text easily using these properties.
Fonts
The font codes let you adjust the properties of whatever font you decide to use (when called with font: or font-family: ).
Boxes
These properties allow you to draw boxes and create different four-sided shapes.
Tables
Tables are useful for displaying tabular data, and positioning items around the page in a structured way.
Paging
Page breaks allow for new pages to be added without excess line breaks filling in the space, and distorting design.
Interface
Adjust the interface and design of your page by using the interface properties.
Selectors
Control your code with the following selectors:
Pseudo-Selectors and Pseudo-Classes
Sizes & Colours
RELATIVE SIZES
ABSOLUTE SIZES
COLOURS