Containers are used as "boxes" for web parts. They consist of content that is displayed before and after the web part which means they are used as an envelope for web part content. They have three advantages over using the ContentBefore and ContentAfter properties:
1. They are re-usable for many web parts.
2. They can contain a title and dynamically inserted values of the web part properties.
3. They are objects in the system, which means they can be Exported and Imported.
Containers can be assigned not only to web parts, but also widgets and entire web part zones.
Containers are assigned to web parts, widgets or zones simply by configuring () them and selecting a container through the Web part container property.
Please see the Developer's Guide -> Development -> Web parts -> Web part containers -> Creating web part containers topic for a step-by-step guide on how a new container is created.