0

I am labeling some points in TileMill using CartoCSS.

The labels are a composite of two variables

text-name: [NAME]+' '+[TYPE];

The rule above inserts a space between the two variables. How can I add a line break?

I have tried

text-name: [NAME]+<br>+[TYPE];

.

text-name: [NAME]+'<br>'+[TYPE];

.

text-name: [NAME]+'_'+[TYPE];
text-wrap-character: '_';

All to no avail. Any suggestions?

1 Answer 1

2

The code for a new line in CartoCSS is \n. So you can do

text-name: [NAME]+'\n'+[TYPE];

The text-wrap-character approach will work as well, you just need to make sure to set text-wrap-width to a very low value such as 1 to trigger the wrapping.

Further reading: https://www.mapbox.com/tilemill/docs/guides/styling-labels/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.