CSS Layout Tutorial

By Xah Lee. Date: . Last updated: .

CSS has many ways to create layout and layers.

Here are the major methods.

Using Table Layout

Pure CSS Table

Flow Around Blocks

The float property can make text flow around a image or a block element.

See: CSS Text Flow Around Image

Using Margin

Margin can be used to create several columns or panes.

CSS: 3 Columns Layout

Multi-Column Layout

CSS: Multi-Column/Newspaper Layout

Create Layer

CSS Position: static, relative, fixed, absolute

Hide Element

A element can be hidden by:

visibility: visible
normal.
visibility: hidden
maket it invisible, but it still occupies the same space.
display: none
make invisible and occupies no space. (effectively as the element doesn't exist.)

These are useful especially when used together with JavaScript. For example, for collapsible list, popup tooltip.

[see How to Create Tooltip]

JS in Depth
XAH  BUY NOW

CSS

Basics

Color

Font

Text Decoration

Box Model

Box Decoration

Layout

Layers

Transform/Animation

Line Wrap

Misc