Tag Archives: text alignment

RaphaelJS simple text align

Recently I noticed lots of questions on StackOverFlow regarding text alignment in RaphaelJS.

By default RaphaelJS alignes text to the middle as you can see on the image below:

default middle text alignment

To align text to the left you set text-anchor attribute to “start”. Or to “end” to align text to the right.

R.text(50, 100, 'Some text goes here').attr({'font-size': 11, 'text-anchor': 'start'});

Result – text aligned to the left:

text aligned to the left

Leave a comment

Posted by on July 27, 2011 in RaphaelJS



%d bloggers like this: