CSS - Box Basics 101 |
|||||
| |
Featuring:
CSS-Cascading Style Sheets -Box Basics Credit: Imagenation The basics of boxes, pages, and borders
are all summarized in the Figure below taken from the W3C basic
documentation on the CSS1 recommendation: Notice how HTML Core Content like a simple line or paragraph text is surrounded conceptually by a padding box which in turn has an border box surrounding it. The outer edge of the border box forms the border used in any CSS style. For example, this generic class .thick { border: 3px dashed black; } will create a thick, dashed outer border around any text. Then outside the border box is the margin box whose outer edge either forms the page boundary or the region boundary. Each of the abbreviations in the figure corresponds to a CSS box attribute or styling property as follows: TB - border-top: red solid 2px;Notice how we supplied the color, style and thickness/width values for each attribute of the border definition. They could have been spelled out in detail. So - border-top: red solid 2px fully specified would be: border-top-color: red; border-top-style: solid; border-top-width: 2px; This will be the inspiration of a couple of generic styling classes which we will create to show off some box and border styling possibilities: .doubleline {border-top-color: red; border-top-style:
solid; border-top-width: 2px;
border-bottom-color: red; border-bottom-style: solid; border-bottom-width: 2px; The Box
Using the boxquote style as a generic class we can create a box with a quote
from the text with the following CSS code: |
||||
Top of Page Tutorials Home CSS references |