Place a text content in the middle of a container

user2879704

I am using collage, so that the elements will be placed in the middle of the box.

import Graphics.Element exposing (show)
import Graphics.Collage exposing (collage)

textBox =
  show "hello world"

main =
  collage 1000 1000 [textBox]

But there is a typemismatch error at the last line as,

Graphics.Element.Element
Graphics.Collage.Form

Since, show function returns Element whereas collage accepts only Form. What other function can i use, to position the text content in the middle of the collage?

grumpyjames

You can convert an Element to a Form with Graphics.Collage.toForm

toForm : Element -> Form

http://package.elm-lang.org/packages/elm-lang/core/2.1.0/Graphics-Collage#toForm

Your program simply becomes

main = collage 1000 1000 [toForm textBox]

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Place an image in the middle of a block of text

From Dev

How to align content to middle of container Bootstrap

From Dev

place text at bottom in right aligned div container

From Dev

Place the text in the middle of QProgressBar when setRange(0, 0) on Windows?

From Dev

Insert Content into specific place in Text File in Powershell

From Dev

Place image in the middle of a td

From Dev

how to place css div container "text-align: center ;"

From Dev

How to place an ellipsis in the center of the content of a label or a text of a textbloxk

From Dev

Vertical align "link text" to middle of li item (and make text-size scale accordingly to fit li container)

From Dev

Adding content of a text file to middle of other text file before a particular string

From Dev

How to place menu items in middle?

From Dev

Bootstrap: Content in the middle?

From Dev

content to sit in the middle of div

From Dev

css align content in middle

From Dev

Content in the middle (grid)

From Dev

Putting tab content in the middle

From Dev

Vertical middle content in div?

From Dev

Make the content of the overlay in the middle

From Dev

Why is the Content not aligned in the middle?

From Dev

Table cell content: align text top-left and image in the middle in HTML

From Dev

How to append and delete data in the middle of a text file, shifting the remaining file content using java code?

From Dev

Table cell content: align text top-left and image in the middle in HTML

From Dev

Hide container when there is no place

From Dev

Putting text at the middle of an <hr>

From Dev

CSS - Separator with text in middle

From Dev

Middle centered text inline

From Dev

Line in the middle of the text

From Dev

Display text middle in span

From Dev

inline block and middle text?

Related Related

  1. 1

    Place an image in the middle of a block of text

  2. 2

    How to align content to middle of container Bootstrap

  3. 3

    place text at bottom in right aligned div container

  4. 4

    Place the text in the middle of QProgressBar when setRange(0, 0) on Windows?

  5. 5

    Insert Content into specific place in Text File in Powershell

  6. 6

    Place image in the middle of a td

  7. 7

    how to place css div container "text-align: center ;"

  8. 8

    How to place an ellipsis in the center of the content of a label or a text of a textbloxk

  9. 9

    Vertical align "link text" to middle of li item (and make text-size scale accordingly to fit li container)

  10. 10

    Adding content of a text file to middle of other text file before a particular string

  11. 11

    How to place menu items in middle?

  12. 12

    Bootstrap: Content in the middle?

  13. 13

    content to sit in the middle of div

  14. 14

    css align content in middle

  15. 15

    Content in the middle (grid)

  16. 16

    Putting tab content in the middle

  17. 17

    Vertical middle content in div?

  18. 18

    Make the content of the overlay in the middle

  19. 19

    Why is the Content not aligned in the middle?

  20. 20

    Table cell content: align text top-left and image in the middle in HTML

  21. 21

    How to append and delete data in the middle of a text file, shifting the remaining file content using java code?

  22. 22

    Table cell content: align text top-left and image in the middle in HTML

  23. 23

    Hide container when there is no place

  24. 24

    Putting text at the middle of an <hr>

  25. 25

    CSS - Separator with text in middle

  26. 26

    Middle centered text inline

  27. 27

    Line in the middle of the text

  28. 28

    Display text middle in span

  29. 29

    inline block and middle text?

HotTag

Archive