Hi
I am trying to play with the CSS and HH.Value_
pattern from @JordanMartinez learn-halogen
using the adding CSS as blueprint
How do I use fontFamily and textColor?
Initially I tried to as [HH.span.. [CSS.style ] ]
staticHtmlWithPropsAndCss :: StaticHTML
staticHtmlWithPropsAndCss =
HH.div
[ HP.id_ "top-div", CSS.style $ backgroundColor tomato ]
[ HH.div
[ HP.class_ $ ClassName "special-div" ]
[ HH.span
[ HP.classes [ ClassName "class1", ClassName "class2", ClassName "class3" ]
, CSS.style do
fontSize $ px 20.0
-- fontFamily ["monospace", "white"] ["sansSerif"]
backgroundColor orchid
]
[ HH.text "This is text in a span!" ]
]
]
, HH.button
[ HP.type_ ButtonButton ]
[ HH.text "You can click me, but I don't do anything." ]
]
How do I specify span into an h1?
For example this html
staticHtmlWithPropsAndCss :: StaticHTML
staticHtmlWithPropsAndCss =
HH.div
[ HP.id_ "top-div", CSS.style $ backgroundColor tomato ]
[ HH.div
[ HP.class_ $ ClassName "special-div" ]
[HH.h1
, CSS.style do
fontFamily ["monospace", "white"] ["sansSerif"]
textColor white
[ HH.span
[ HP.classes [ ClassName "class1", ClassName "class2", ClassName "class3" ]
, CSS.style do
fontSize $ px 20.0
-- fontStyle $ monospace
-- fontFamily ["monospace", "white"] ["sansSerif"]
backgroundColor orchid
-- textColor white
]
[ HH.text "This is text in a span!" ]
]
]
, HH.button
[ HP.type_ ButtonButton ]
[ HH.text "You can click me, but I don't do anything." ]
]
What I am trying to do is something like this
<html>
<head>
<style>
.button {
background-color: #4CAF50;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
</style>
</head>
<body>
<div id="top-div">
<div class="special-div">
<h1 style="color:blue; font-family:courier">
<span class="class1 class2 class3" style="background-color:orchid; color:white;
font-size:50%; font-family:verdana;
text-align:center;">This is text in a span!</span>This is the h1 text!</h1>
<div>
<button class="button" type="button">You can click me, but I don't do anything</button>
</div>
</div>
</div>
</body>
</html>
As a workaround I can add <style> .button {
to the html in static-html folder, but wonder if there’s a proper halogen way…
, HH.button
[ HP.type_ ButtonButton
, HP.class_ $ ClassName "button"
]
[ HH.text "You can click me, but I don't do anything." ]
]
And
Thanks!