Tutorials References Exercises Bootcamp Menu
Sign Up Create Website Get Certified Pro

Template Filter - center


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.


{{ 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.


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