import Element
import Element.Font as Font
view =
Element.el
[ Font.color (Element.rgb 0 0 1)
, Font.size 18
, Font.family
[ Font.typeface "Open Sans"
, Font.sansSerif
]
]
(Element.text "Woohoo, I'm stylish text")Note: Font.color, Font.size, and Font.family are inherited, meaning you can set them at the top of your view and all subsequent nodes will have that value.
Other Note: If you're looking for something like line-height, it's handled by Element.spacing on a paragraph.
Font sizes are always given as px.
import Element
import Element.Font as Font
myElement =
Element.el
[ Font.family
[ Font.typeface "Helvetica"
, Font.sansSerif
]
]
(text "")Font.external can be used to import font files. Let's say you found a neat font on http://fonts.google.com:
import Element
import Element.Font as Font
view =
Element.el
[ Font.family
[ Font.external
{ name = "Roboto"
, url = "https://fonts.googleapis.com/css?family=Roboto"
}
, Font.sansSerif
]
]
(Element.text "Woohoo, I'm stylish text")Align the font to the left.
Align the font to the right.
Center align the font.
In px.
In px.
This will reset bold and italic.
A glow is just a simplified shadow