Web Design at Georgetown CollegeBeta

CSS Basics and Box Model

What You Need To Know

Getting started

Copy the following code into your file to setup the basic page structure.

<!DOCTYPE html>
<html>
<head>
	<title></title>
	<meta charset="utf-8">
	<meta name="viewport" content="initial-scale=1.0, width=device-width">
	<link rel="stylesheet" href="normalize.css">
	<link rel="stylesheet" href="style.css">
</head>
<body>
	
</body>
</html>

CSS structure

selector {
	property: value;
}

Properties

Example

This is an example of the above CSS properties.

Diagram of CSS box model
Diagram of CSS box model - source

CSS Box Model/Layout

Example div with styles

More Properties

  • Images
    • Resizing
    • Centering
      • display: block;
      • margin: 0 auto;
  • Miscellaneous
    • Links and :hover pseudo class
    • Hover Link
    • Styling lists
      • list-style-type
    • Styling horizontal rules
      • border
    • Viewing source code in a browser
    • Using Coda reference books (also, HTML and CSS versions on the web)