Tutorials References Exercises Videos Menu
Free Website Get Certified Upgrade

Template Filter - center


Example

Write the name in the middle of a 20 characters field:

<h1>{{ name|center:20 }}.</h1>
Run Example »

Definition and Usage

The center filter places the value in the center of a value of the specified length.


Syntax

{{ value|center:length }}

Template filters are defined by using a pipe | character followed by the name of the filter.

Arguments are defined by using a colon : character followed by the argument value.


Arguments

Value Description
length Required. A number specifying the length of the field where the value will be in the center.