Hi. I’m learning Elm and elm-ui and I’m struggling with something pretty basic. I have a pretty minimal example that displays a centered string correctly but only when I use elm reactor. When instead I compile the js manually and use it in my html file, it only covers as much as it needs to cover vertically. For the life of my I haven’t figured out why.
Here’s the elm code:
module Main exposing (..)
import Element exposing (..)
import Element.Border as Border
import Element.Font as Font
import Html exposing (Html)
menu : Element msg
menu =
row
[ width fill
, padding 20
, spacing 20
]
[ el
-- "logo" element
[ width <| px 80
, height <| px 40
, Border.width 2
, Border.rounded 6
, Border.color <| rgb255 0xc0 0xc0 0xc0
]
none
, el [ alignRight ] <| text "Services"
, el [ alignRight ] <| text "About"
, el [ alignRight ] <| text "Contact"
]
main : Html msg
main =
layout
[ width fill, height fill, inFront menu ]
<| el [ centerX, centerY, padding 50 ]
<| paragraph
[ Font.size 48, Font.center ]
[ text "Welcome to "
, el [ Font.italic ] <| text "this"
, text ""
]
and here’s the html:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Nocturna</title>
<style>
</style>
</head>
<body>
<main>
<div id="elm"></div>
</main>
<script src="elm.js"></script>
<script>
var app = Elm.Main.init({
node: document.getElementById('elm')
});
</script>
</body>
</html>
Any help would be very much appreciated