XML-Technologien / XSL-FO / Referenz / Antenna House Formatter XSL Extensions / Properties / box-shadow

(Auszug aus "XSL-FO ― Die Referenz" von Manuel Montero Pineda & Steffen Herkert, 2016, dpunkt.verlag)

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

Category Borders >> Box Shadow

Specifies the box shadow. [CSS3-Background] Drop Shadows: the ‘box-shadow’ property

Value:

none | inset? && [ <length>{2,4} && <color>? ]#

Initial:

none

Applies to:

all elements which can have borders

Inherited:

no

Percentages:

N/A

Values have the following meanings.

none

No shadow is displayed.

inset

An inner shadow is displayed.This setting is ignored with AH Formatter V6.3 Lite. V6.3[no-LT]

The meanings of <length>s and a <color> are as follows:

  • The first <length> is an offset of a horizontal shadow. It becomes a right-side shadow of a region when a positive value is specified. It becomes a left-side shadow of a region when a negative value is specified.

  • The second <length> is an offset of a vertical shadow. It becomes a bottom-side shadow of a region when a positive value is specified. It becomes a top-side shadow of a region when a negative value is specified.

  • The 3rd <length> must be a non-negative value and specifies the blur radius. If the value is 0, there is no blur. This setting is ignored with AH Formatter V6.3 Lite. V6.3no-LT

  • The 4th <length> extends a shadow. When a positive value is specified, the region will be expanded. When a negative value is specified, the region will be reduced. V6.3no-LT

  • The color of the shadow can be specified by <color>.

This combination can be specified multiply and shadows can be added several times over. V6.3

CAUTION:

The minimum unit of <length> which can be specified is 1/96in=0.265mm. The value is rounded to its multiple number.

CAUTION:

The blur is invalid with the device which cannot output transparency like PDF/X.

XSL-FO sample:

<fo:root xml:lang="en" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:cpfo="http://www.compart.net/xmlns/cpfo" xmlns:svg="http://www.w3.org/2000/svg" xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions">
<axf:document-info name="document-title" value="Box shadow"/>
<axf:document-info name="author" value="Antenna House, Inc."/>
<fo:layout-master-set>
<fo:simple-page-master page-height="297mm" page-width="210mm" margin-top="10mm" margin-left="20mm" margin-right="20mm" margin-bottom="10mm" master-name="PageMaster1">
<fo:region-after extent="7mm"/>
<fo:region-body margin-top="0mm" margin-left="0mm" margin-right="0mm" margin-bottom="10mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="PageMaster1">
<fo:static-content flow-name="xsl-region-after">
<fo:block font-size="0.8em" text-align="right" color="green">
<fo:basic-link external-destination="http://www.antennahouse.com/">
Antenna House, Inc.
</fo:basic-link>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body" font-family="serif" font-size="1em" line-height="1.4" axf:hyphenate-hyphenated-word="false" hyphenate="true">
<fo:block span="all" font-family="sans-serif" font-size="2em" font-weight="bold" line-height="2" space-before="1em" space-after="1em" space-before.conditionality="retain" space-after.conditionality="retain" background-color="#EEEEEE">
<fo:block start-indent="1em" end-indent="1em">
Box shadow 
</fo:block>
</fo:block>
<fo:block span="all" space-before="1em" space-after="1em" space-after.conditionality="retain" text-indent="0em" border="1pt solid #9999FF" start-indent="0.5em" end-indent="0.5em" padding="0.5em" text-align="justify">

The box shadow can be specified by axf:box-shadow. Specify axf:box-shadow="10px 10px 10px 10px darkgray", the values are an offset of a horizontal shadow, an offset of a vertical shadow, the blur radius, shadow expantion and the color o f the shadow in order. By adding the inset setting, the inner shadow can be added.
</fo:block>
<fo:block space-before="1em" font-family="sans-serif" font-size="1.2em" font-weight="bold" text-indent="0em" line-height="2" keep-with-next.within-column="always">
axf:box-shadow="10px 10px 0px 0px darkgray"
</fo:block>
<fo:block-container width="100mm" height="12mm" border="solid black 2pt" axf:box-shadow="10px 10px 0px 0px darkgray" space-after="1.5em">
<fo:block/>
</fo:block-container>
<fo:block space-before="1em" font-family="sans-serif" font-size="1.2em" font-weight="bold" text-indent="0em" line-height="2" keep-with-next.within-column="always">
axf:box-shadow="10px 10px 5px 0px darkgray"
</fo:block>
<fo:block-container width="100mm" height="12mm" border="solid black 2pt" axf:box-shadow="10px 10px 5px 0px darkgray" space-after="1.5em">
<fo:block/>
</fo:block-container>
<fo:block space-before="1em" font-family="sans-serif" font-size="1.2em" font-weight="bold" text-indent="0em" line-height="2" keep-with-next.within-column="always">
axf:box-shadow="10px 10px 0px 8px darkgray"
</fo:block>
<fo:block-container width="100mm" height="12mm" border="solid black 2pt" axf:box-shadow="10px 10px 0px 8px darkgray" space-after="2em">
<fo:block/>
</fo:block-container>
<fo:block space-before="1em" font-family="sans-serif" font-size="1.2em" font-weight="bold" text-indent="0em" line-height="2" keep-with-next.within-column="always">
axf:box-shadow="inset 10px 10px 0px 0px darkgray"
</fo:block>
<fo:block-container width="100mm" height="12mm" border="solid black 2pt" axf:box-shadow="inset 10px 10px 0px 0px darkgray" space-after="2em">
<fo:block/>
</fo:block-container>
<fo:block>
When an offset of the shadow is a negative value, the region of the reverse side when a positive value is specified will become the shadow. The combination of values can be specified multiply and shadows can be added several times over.
</fo:block>
<fo:block space-before="1em" font-family="sans-serif" font-size="1.2em" font-weight="bold" text-indent="0em" line-height="2" keep-with-next.within-column="always">
axf:box-shadow="-10px -10px darkgray"
</fo:block>
<fo:block-container width="100mm" height="12mm" border="solid black 2pt" axf:box-shadow="-10px -10px darkgray" space-before="0.5em" space-after="1em" start-indent="1em">
<fo:block/>
</fo:block-container>
<fo:block space-before="1em" font-family="sans-serif" font-size="1.2em" font-weight="bold" text-indent="0em" line-height="2" keep-with-next.within-column="always">
axf:box-shadow="10px 10px dimgray,20px 20px darkgray,30px 30px lightgrey"
</fo:block>
<fo:block-container width="100mm" height="12mm" border="solid black 2pt" axf:box-shadow="10px 10px dimgray,20px 20px darkgray,30px 30px lightgrey">
<fo:block/>
</fo:block-container>
</fo:flow>
</fo:page-sequence>
</fo:root>

Download der Beispiele

Output:

nach oben