Spacing around elements / linebreaks in text

Home Forums FAQ / Tips Spacing around elements / linebreaks in text

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1589
    Jeremy
    Keymaster

    If you want all the text lines you add with newText in your experiment to have some spacing before and/or after them, the best strategy is to use CSS. Take a look at the Aesthetics page on the documentation.

    You can also punctually use an empty element to add some vertical spacing. For instance, you can create an empty canvas of 1x40px to insert a spacing of 40px between two lines of text:

    newText("hello", "Hello")
        .print()
    ,
    newCanvas("empty canvas", 1, 40)
        .print()
    ,
    newText("world", "World")
        .print()
    

    Since newText accepts HTML code, you can also insert linebreaks into your text using the tag <br> or <p></p>:

    newText("hello", "Hello
    world") .print() , newText("hello", "

    Hello

    world

    ") .print()
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.