Size expressions for bordered boxes
Define the outer bounds of a box by using the X-Size and Y-Size properties.
The X-Sizeand Y-Size properties specify the inner size of the box. For example, if a box is 3cm wide and has a 1mm thick border on all sides, the box's outer bounds appear to be 3.2cm wide. This conforms to the CSS specification.
You can define the outer bounds of a box instead:
- Determine the X-Size and Y-Size values by subtracting the width of the borders from the desired height and width. For example, if you want a box to be 3cm wide on the outside while having 1mm borders on all sides, calculate the width to be 3cm-2mm=2.8cm wide.
- If you want a box to have the same size as its parent, set both the X-Size and Y-Size properties to the value max. You do not have to subtract the borders, since the system automatically adjusts the value of max in cases where the box has borders. For example, if the box has a 1mm border and is contained in a box that is 3cm high and wide, the outer bounds of the contained box are also 3cm.
For bordered boxes, do not use expressions that contain max as only one of its components, such as max/2. See following section for details.
Size expressions that contain the variable max with other components
Expressions such as max-2cm or max/2 can have unexpected results when you specify the height and width of bordered boxes. Modify these expressions as follows:
- Take the original formula and replace any occurrence of max with (max+borders+padding+margin), where "borders", "padding", and "margin" denote the width values for each on both sides of the box.
- Take the resulting formula (which we'll call "f") from step 1, and create the final formula as f-borders-padding-margin.
For example, the original properties box are:
- X-Size = max/2
- leftBorderWidth=2mm
- leftMargin=1mm
- rightBorderWidth=1.5mm
- rightPadding=3mm
X-Size is then changed in the following steps:
- X-Size = (max+2mm+1mm+1.5mm+3mm)/2; this is "f" in the explanation.
- X-Size = (max+2mm+1mm+1.5mm+3mm)/2-2mm-1mm-1.5mm-3mm, which can be consolidated to (max-7.5mm)/2-7.5mm.