Back to Element Plus

Watermark

docs/en-US/component/watermark.md

2.13.74.0 KB
Original Source

Watermark

Add specific text or patterns to the page.

Basic usage

The most basic usage.

:::demo

watermark/basic

:::

Multi-line watermark

Use content to set an array of strings to specify multi-line text watermark content.

:::demo

watermark/multi-line

:::

Image watermark

Specify the image address via image. To ensure that the image is high definition and not stretched, set the width and height, and upload at least twice the width and height of the logo image address.

:::demo

watermark/image

:::

Custom configuration

Preview the watermark effect by configuring custom parameters.

:::demo

watermark/custom

:::

API

Attributes

NameDescriptionTypeDefault
widthThe width of the watermark, the default value of content is its own width^[number]120
heightThe height of the watermark, the default value of content is its own height^[number]64
rotateWhen the watermark is drawn, the rotation Angle, unit °^[number]-22
z-indexThe z-index of the appended watermark element^[number]9
imageImage source, it is recommended to export 2x or 3x image, high priority^[string]
contentWatermark text content^[string]/^[array]string[]Element Plus
fontText styleFontFont
gapThe spacing between watermarks^[array][number, number][100, 100]
offsetThe offset of the watermark from the upper left corner of the container. The default is gap/2^[array][number, number][gap[0]/2, gap[1]/2]

Font

NameDescriptionTypeDefault
colorfont color^[string]rgba(0,0,0,.15)
fontSizefont size^[number] / ^[string]16
fontWeightfont weight^[enum]'normal' | 'bold' | 'lighter' | 'bolder' | numbernormal
fontFamilyfont family^[string]sans-serif
fontGap ^(2.11.5)font gap^[number]3
fontStylefont style^[enum]'none' | 'normal' | 'italic' | 'oblique'normal
textAligntext align^[enum]'left' | 'right' | 'center' | 'start' | 'end' center
textBaselinetext baseline^[enum]'top' | 'hanging' | 'middle' | 'alphabetic' | 'ideographic' | 'bottom'hanging

Slots

NameDescription
defaultcontainer for adding watermark