Next page Previous page Start of chapter End of chapter

Position properties

Position properties allow to layout the element boxes on the page. There are two of these properties, position and float. The first one has four possible values:

The float property allows to make floating boxes. It has two values, left and right. A box that is required to float left (respectively, right) is moved left (respectively, right) as far as possible. The following elements floats around the box with the float position. For instance, in our recipe example, we can float the ingredients to the left and let the directions and story elements float around. The only rule that we need is this (the paddings are not necessary):

ingredients {
  float: left;
  padding-right: 1em;
  padding-bottom: 1em;
}

Here is the new layout. Notice that the elements do not overlap anymore whatever is the font size. The clear property specifies which side of a box should not be adjacent to other floating boxes. For instance, if we want to place the story element always below the ingredients, we can add this rule:

story {clear: left;}
Next page Previous page Start of chapter End of chapter
Caffè XML - Massimo Franceschet